Skip to content

Commit

Permalink
docs: update openapi docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Parth Shandilya committed Apr 21, 2022
1 parent 83f8c92 commit 71ce92c
Show file tree
Hide file tree
Showing 75 changed files with 1,567 additions and 454 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Ivan Goncharov
Copyright (c) 2019-2022 CERN.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# CAP API Documentation OpenAPI Specification
# CERN Analysis Preservation REST API Documentation

### About

This is the documentation behind the REST API for [CERN Analysis Preservation](https://analysispreservation.cern.ch/).

Other documentation:
- [CERN Analysis Preservation Docs](https://analysispreservation.cern.ch/docs/general/)
- [CERN Analysis Preservation Client](https://analysispreservation.cern.ch/docs/cli/)

If you need help or have a question about the API Documentation, please contact us via our [email](analysis-preservation-support@cern.ch).

# OpenAPI Specification

## Working on specification
### Install

1. Install [Node JS](https://nodejs.org/)
Expand All @@ -18,4 +29,4 @@ Bundles the spec and prepares web_deploy folder with static assets.
Validates the spec.

#### `npm run gh-pages`
Deploys docs to GitHub Pages. You don't need to run it manually if you have Travis CI configured.
Deploys docs to GitHub Pages.
12 changes: 0 additions & 12 deletions spec/code_samples/C#/records/post.cs

This file was deleted.

7 changes: 0 additions & 7 deletions spec/code_samples/PHP/records/post.php

This file was deleted.

3 changes: 0 additions & 3 deletions spec/code_samples/Python/records/get.py

This file was deleted.

9 changes: 0 additions & 9 deletions spec/code_samples/README.md

This file was deleted.

12 changes: 12 additions & 0 deletions spec/components/examples/FileLocalUploadResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
value:
size: 442
delete_marker: false
links: {}
created: "2022-04-20T13:13:01.105707+00:00"
updated: "2022-04-20T13:13:01.113000+00:00"
tags: {}
version_id: b5f224ef-efe2-4ea5-9b47-d13623dd47bb
is_head: true
key: testname
mimetype: text/plain
checksum: md5:c63fcd62028c636019556ee6a1f2f62c
9 changes: 9 additions & 0 deletions spec/components/examples/JSONSchemaAllVersions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
value:
latest:
links: {}
version: 0.0.2
versions:
- links: {}
version: 0.0.1
- links: {}
version: 0.0.2
7 changes: 3 additions & 4 deletions spec/components/examples/JSONSchemaResource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ value:
fullname: MySchema Analysis
is_indexed: true
links:
deposit: >-
https://analysispreservation.cern.ch/schemas/deposits/records/myschema-v0.0.1.json
record: 'https://analysispreservation.cern.ch/schemas/records/myschema-v0.0.1.json'
self: 'http://localhost:5000/api/jsonschemas/myschema/0.0.1'
deposit: https://analysispreservation.cern.ch/api/schemas/deposits/records/myschema-v0.0.1.json
record: https://analysispreservation.cern.ch/api/schemas/records/myschema-v0.0.1.json
self: https://analysispreservation.cern/ch/api/jsonschemas/myschema/0.0.1
name: myschema
record_mapping: {}
record_options: {}
Expand Down
32 changes: 32 additions & 0 deletions spec/components/examples/bucketResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
value:
contents:
- mimetype: application/x-sh
delete_marker: false
tags: {}
links:
self: >-
https://analysispreservation.cern/ch/api/files/d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f/hello/world/redirects.sh
version: >-
https://analysispreservation.cern/ch/api/files/d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f/hello/world/redirects.sh?versionId=5d7e05ea-7c7c-48b9-913b-8ebadf26182e
uploads: >-
https://analysispreservation.cern/ch/api/files/d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f/hello/world/redirects.sh?uploads
size: 163
is_head: true
version_id: 5d7e05ea-7c7c-48b9-913b-8ebadf26182e
checksum: 'md5:b8c74d3430930c8ee0f1b53e525175ba'
updated: '2020-10-12T13:39:07.880982+00:00'
key: hello/world/redirects.sh
created: '2020-10-12T13:39:07.871349+00:00'
locked: false
links:
self: 'https://analysispreservation.cern/ch/api/files/d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f'
versions: >-
https://analysispreservation.cern/ch/api/files/d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f?versions
uploads: >-
https://analysispreservation.cern/ch/api/files/d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f?uploads
size: 8425
updated: '2020-10-12T13:39:07.894887+00:00'
id: d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f
max_file_size: null
quota_size: null
created: '2020-10-12T13:21:40.302308+00:00'
6 changes: 6 additions & 0 deletions spec/components/examples/collectionResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
value:
drafts: {}
published: {}
schema_data: {}
user_drafts: {}
user_published: {}
8 changes: 8 additions & 0 deletions spec/components/examples/dashboardResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
value:
drafts: {}
published: {}
user_count: 1
user_drafts: {}
user_draft_count: 10
user_published: {}
user_published_count: 1
78 changes: 38 additions & 40 deletions spec/components/examples/depositResponse.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
value:
access:
- action: deposit-read
identity: cms_user@cern.ch
type: user
- action: deposit-update
identity: cms_user@cern.ch
type: user
- action: deposit-admin
identity: cms_user@cern.ch
type: user
- deposit-read:
- roles: [test_role_1]
- users: [{email: cms_user@cern.ch, profile: {}}]
- deposit-update:
- roles: [test_role_1]
- users: [{email: cms_user@cern.ch, profile: {}}]
- deposit-admin:
- roles: [test_role_1]
- users: [{email: cms_user@cern.ch, profile: {}}]
can_admin: true
can_update: true
created: 2019-08-29T08:36:37.552Z
created_by:
- email: cms_user@cern.ch
- profile: {}
experiment: CMS
files:
- bucket: 1e72bd32-c2e3-403e-9c01-2faa0b149999
checksum: None
key: test-user_test-repo_test-branch.tar.gz
size: 0
source_url: 'https://gitlab.cern.ch/test-user/test-repo/tree/test-branch'
source_url: https://gitlab.cern.ch/test-user/test-repo/tree/test-branch
version_id: ffe05069-8f2a-49da-8617-957b05614723
id: 055c24bad4ee4d6fa44a9432b49fe77e
links: {}
metadata: null
$schema: >-
https://analysispreservation.cern.ch/schemas/deposits/records/test-analysis-v0.0.1.json
_deposit:
created_by: 1
id": 055c24bad4ee4d6fa44a9432b49fe77e
owners:
- cms_user@cern.ch
pid:
revision_id: 0
type: recid
value: CAP.xxx.xxx.xxxx
status: published
experiment: None
_files:
- bucket: 1e72bd32-c2e3-403e-9c01-2faa0b149999
checksum: None
key: test-user_test-repo_test-branch.tar.gz
size: 0
source_url: 'https://gitlab.cern.ch/test-user/test-repo/tree/test-branch'
version_id: ffe05069-8f2a-49da-8617-957b05614723
control_number: CAP.xxx.xxx.xxxx
published: null
revision_id: 0
type: recid
value: CAP.xxx.xxx.xxxx
is_owner: true
labels: []
links:
bucket: https://analysispreservation.cern/ch/api/files/1e72bd32-c2e3-403e-9c01-2faa0b149999
clone: https://analysispreservation.cern/ch/api/deposits/055c24bad4ee4d6fa44a9432b49fe77e/actions/clone
discard: https://analysispreservation.cern/ch/api/deposits/055c24bad4ee4d6fa44a9432b49fe77e/actions/discard
disconnect_webhook: https://analysispreservation.cern/ch/api/deposits/055c24bad4ee4d6fa44a9432b49fe77e/actions/disconnect_webhook
edit: https://analysispreservation.cern/ch/api/deposits/055c24bad4ee4d6fa44a9432b49fe77e/actions/edit
files: https://analysispreservation.cern/ch/api/deposits/055c24bad4ee4d6fa44a9432b49fe77e/files
html: https://analysispreservation.cern/ch/drafts/055c24bad4ee4d6fa44a9432b49fe77e
permissions: https://analysispreservation.cern/ch/api/deposits/055c24bad4ee4d6fa44a9432b49fe77e/actions/permissions
publish: https://analysispreservation.cern/ch/api/deposits/055c24bad4ee4d6fa44a9432b49fe77e/actions/publish
self: https://analysispreservation.cern/ch/api/deposits/055c24bad4ee4d6fa44a9432b49fe77e
upload: https://analysispreservation.cern/ch/api/deposits/055c24bad4ee4d6fa44a9432b49fe77e/actions/upload
metadata: {}
schema:
- fullname: CMS Analysis
name: cms-analysis
version: 0.0.1
type: deposit
revision: 2
schema: >-
https://analysispreservation.cern.ch/schemas/deposits/records/test-analysis-v0.0.1.json
status: published
status: draft
updated: 2019-08-29T08:36:38.114Z
webhooks: []
45 changes: 45 additions & 0 deletions spec/components/examples/depositReviewResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
value:
access:
- deposit-read:
- roles: [test_role_1]
- users: [{email: cms_user@cern.ch, profile: {}}]
- deposit-update:
- roles: [test_role_1]
- users: [{email: cms_user@cern.ch, profile: {}}]
- deposit-admin:
- roles: [test_role_1]
- users: [{email: cms_user@cern.ch, profile: {}}]
can_admin: true
can_update: true
created: 2019-08-29T08:36:37.552Z
created_by:
- email: cms_user@cern.ch
- profile: {}
experiment: CMS
files:
- bucket: 1e72bd32-c2e3-403e-9c01-2faa0b149999
checksum: None
key: test-user_test-repo_test-branch.tar.gz
size: 0
source_url: https://gitlab.cern.ch/test-user/test-repo/tree/test-branch
version_id: ffe05069-8f2a-49da-8617-957b05614723
id: 055c24bad4ee4d6fa44a9432b49fe77e
is_owner: true
labels: []
links: {}
metadata: {}
review:
- body: Test
id: f35261fc-2173-41c0-a208-fe7c7edf9831
resolved: false
reviewer: test_cms_reviewer@cern.ch
type: approved
schema:
- fullname: CMS Analysis
- name: cms-analysis
- version: 0.0.1
type: deposit
revision: 2
status: published
updated: 2019-08-29T08:36:38.114Z
webhooks: []
Empty file.
5 changes: 5 additions & 0 deletions spec/components/examples/meResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
value:
deposit_groups: {}
email: test@cern.ch
id: 1
profile: {}
5 changes: 5 additions & 0 deletions spec/components/examples/permissionRequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
value:
email: test@cern.ch
type: user
op: add
action: deposit-read
42 changes: 42 additions & 0 deletions spec/components/examples/recordResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
value:
access:
- record-read:
- roles: [test_role_1]
- users: [{email: cms_user@cern.ch, profile: {}}]
- record-update:
- roles: [test_role_1]
- users: [{email: cms_user@cern.ch, profile: {}}]
- record-admin:
- roles: [test_role_1]
- users: [{email: cms_user@cern.ch, profile: {}}]
can_review: true
can_update: true
created: 2019-08-29T08:36:37.552Z
created_by:
- email: cms_user@cern.ch
- profile: {}
experiment: CMS
files:
- bucket: 1e72bd32-c2e3-403e-9c01-2faa0b149999
checksum: None
key: test-user_test-repo_test-branch.tar.gz
size: 0
source_url: https://gitlab.cern.ch/test-user/test-repo/tree/test-branch
version_id: ffe05069-8f2a-49da-8617-957b05614723
id: 055c24bad4ee4d6fa44a9432b49fe77f
draft_id: 055c24bad4ee4d6fa44a9432b49fe77e
is_owner: true
labels: []
links:
html: https://analysispreservation.cern.ch/published/055c24bad4ee4d6fa44a9432b49fe77f
self: https://analysispreservation.cern.ch/api/records/055c24bad4ee4d6fa44a9432b49fe77f
metadata: {}
schema:
- fullname: CMS Analysis
name: cms-analysis
version: 0.0.1
schemas: {}
type: record
revision: 2
status: published
updated: 2019-08-29T08:36:38.114Z
5 changes: 5 additions & 0 deletions spec/components/examples/uploadRequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
value:
type: repo
url: https://github.com/user/test
webhook: true
event_type: push
15 changes: 15 additions & 0 deletions spec/components/schemas/Access.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
type: object
properties:
roles:
type: array
description: Egroups with access
items:
$ref: '#/components/schemas/Email'
users:
type: array
description: Users with access
items:
email:
$ref: '#/components/schemas/Email'
profile:
$ref: '#/components/schemas/User'
14 changes: 14 additions & 0 deletions spec/components/schemas/Collection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
title: A Collection data resource schema
type: object
properties:
drafts:
type: object
published:
type: object
schema_data:
type: object
user_drafts:
type: object
user_published:
type: object

Loading

0 comments on commit 71ce92c

Please sign in to comment.