Skip to content

Commit 3cbbe7e

Browse files
committed
docs: update on API examples, responses and instructions
Signed-off-by: Ilias Koutsakis <[email protected]>
1 parent 83f8c92 commit 3cbbe7e

34 files changed

+361
-269
lines changed

Diff for: spec/code_samples/C#/records/post.cs

-12
This file was deleted.

Diff for: spec/code_samples/PHP/records/post.php

-7
This file was deleted.

Diff for: spec/code_samples/Python/records/get.py

-3
This file was deleted.

Diff for: spec/code_samples/README.md

-9
This file was deleted.

Diff for: spec/components/examples/bucketResponse.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
value:
2+
contents:
3+
- mimetype: application/x-sh
4+
delete_marker: false
5+
tags: {}
6+
links:
7+
self: >-
8+
http://localhost:3000/api/files/d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f/hello/world/redirects.sh
9+
version: >-
10+
http://localhost:3000/api/files/d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f/hello/world/redirects.sh?versionId=5d7e05ea-7c7c-48b9-913b-8ebadf26182e
11+
uploads: >-
12+
http://localhost:3000/api/files/d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f/hello/world/redirects.sh?uploads
13+
size: 163
14+
is_head: true
15+
version_id: 5d7e05ea-7c7c-48b9-913b-8ebadf26182e
16+
checksum: 'md5:b8c74d3430930c8ee0f1b53e525175ba'
17+
updated: '2020-10-12T13:39:07.880982+00:00'
18+
key: hello/world/redirects.sh
19+
created: '2020-10-12T13:39:07.871349+00:00'
20+
locked: false
21+
links:
22+
self: 'http://localhost:3000/api/files/d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f'
23+
versions: >-
24+
http://localhost:3000/api/files/d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f?versions
25+
uploads: >-
26+
http://localhost:3000/api/files/d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f?uploads
27+
size: 8425
28+
updated: '2020-10-12T13:39:07.894887+00:00'
29+
id: d0d4a30c-0d54-4ae3-ac0a-18fb982aad5f
30+
max_file_size: null
31+
quota_size: null
32+
created: '2020-10-12T13:21:40.302308+00:00'

Diff for: spec/components/examples/depositResponse.yaml

+47-50
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,49 @@
11
value:
22
access:
3-
- action: deposit-read
4-
5-
type: user
6-
- action: deposit-update
7-
8-
type: user
9-
- action: deposit-admin
10-
11-
type: user
12-
created: 2019-08-29T08:36:37.552Z
13-
files:
14-
- bucket: 1e72bd32-c2e3-403e-9c01-2faa0b149999
15-
checksum: None
16-
key: test-user_test-repo_test-branch.tar.gz
17-
size: 0
18-
source_url: 'https://gitlab.cern.ch/test-user/test-repo/tree/test-branch'
19-
version_id: ffe05069-8f2a-49da-8617-957b05614723
20-
id: 055c24bad4ee4d6fa44a9432b49fe77e
21-
links: {}
22-
metadata: null
23-
$schema: >-
24-
https://analysispreservation.cern.ch/schemas/deposits/records/test-analysis-v0.0.1.json
25-
_deposit:
26-
created_by: 1
27-
id": 055c24bad4ee4d6fa44a9432b49fe77e
28-
owners:
29-
30-
pid:
31-
revision_id: 0
32-
type: recid
33-
value: CAP.xxx.xxx.xxxx
34-
status: published
35-
experiment: None
36-
_files:
37-
- bucket: 1e72bd32-c2e3-403e-9c01-2faa0b149999
38-
checksum: None
39-
key: test-user_test-repo_test-branch.tar.gz
40-
size: 0
41-
source_url: 'https://gitlab.cern.ch/test-user/test-repo/tree/test-branch'
42-
version_id: ffe05069-8f2a-49da-8617-957b05614723
43-
control_number: CAP.xxx.xxx.xxxx
44-
published: null
45-
revision_id: 0
46-
type: recid
47-
value: CAP.xxx.xxx.xxxx
48-
revision: 2
49-
schema: >-
50-
https://analysispreservation.cern.ch/schemas/deposits/records/test-analysis-v0.0.1.json
51-
status: published
52-
updated: 2019-08-29T08:36:38.114Z
3+
deposit-admin:
4+
roles: []
5+
users:
6+
7+
deposit-read:
8+
roles: []
9+
users:
10+
11+
deposit-update:
12+
roles: []
13+
users:
14+
15+
created: '2020-10-07T10:57:13.800870+00:00'
16+
created_by: [email protected]
17+
experiment: CMS
18+
files: []
19+
id: 7f43c45e71ee4b86a9c3045ea57f09ad
20+
is_owner: true
21+
labels: []
22+
links:
23+
bucket: 'http://localhost:3000/api/files/3683bc9a-3d11-4695-a68e-07a7f63b3ec9'
24+
clone: >-
25+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/clone
26+
discard: >-
27+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/discard
28+
disconnect_webhook: >-
29+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/disconnect_webhook
30+
edit: >-
31+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/edit
32+
files: 'http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/files'
33+
html: 'http://localhost:3000/drafts/7f43c45e71ee4b86a9c3045ea57f09ad'
34+
permissions: >-
35+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/permissions
36+
publish: >-
37+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/publish
38+
self: 'http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad'
39+
upload: >-
40+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/upload
41+
metadata: {}
42+
revision: 0
43+
schema:
44+
fullname: CMS Analysis
45+
name: cms-analysis
46+
version: 0.0.1
47+
status: draft
48+
type: deposit
49+
updated: '2020-10-07T10:57:13.800875+00:00'

Diff for: spec/components/examples/depositSearchResponse.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
value:
2+
aggregations: {}
3+
hits:
4+
hits:
5+
- access:
6+
deposit-admin:
7+
roles: []
8+
users:
9+
10+
deposit-read:
11+
roles: []
12+
users:
13+
14+
deposit-update:
15+
roles: []
16+
users:
17+
18+
created: '2020-10-07T10:57:13.800870+00:00'
19+
created_by: [email protected]
20+
experiment: CMS
21+
files: []
22+
id: 7f43c45e71ee4b86a9c3045ea57f09ad
23+
is_owner: true
24+
labels: []
25+
links:
26+
bucket: 'http://localhost:3000/api/files/3683bc9a-3d11-4695-a68e-07a7f63b3ec9'
27+
clone: >-
28+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/clone
29+
discard: >-
30+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/discard
31+
disconnect_webhook: >-
32+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/disconnect_webhook
33+
edit: >-
34+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/edit
35+
files: >-
36+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/files
37+
html: 'http://localhost:3000/drafts/7f43c45e71ee4b86a9c3045ea57f09ad'
38+
permissions: >-
39+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/permissions
40+
publish: >-
41+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/publish
42+
self: 'http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad'
43+
upload: >-
44+
http://localhost:3000/api/deposits/7f43c45e71ee4b86a9c3045ea57f09ad/actions/upload
45+
metadata: {}
46+
revision: 0
47+
schema:
48+
fullname: CMS Analysis
49+
name: cms-analysis
50+
version: 0.0.1
51+
status: draft
52+
type: deposit
53+
updated: '2020-10-07T10:57:13.800875+00:00'
54+
total: 1
55+
links:
56+
- 'http://localhost:3000/api/deposits/?page=1&size=10'

Diff for: spec/components/examples/permissionRequest.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
value:
2+
3+
type: user
4+
op: add
5+
action: deposit-read

Diff for: spec/components/examples/uploadRequest.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
value:
2+
type: repo
3+
url: 'https://github.com/user/test'
4+
webhook: true
5+
event_type: push

Diff for: spec/components/examples/validationError.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
summary: Payload doesn't validate against specified schema
22
value:
33
status: 400
4-
message: You have to specify either $schema or $ana_type
4+
message: 'Validation error: `error message`.'

Diff for: spec/components/schemas/Deposit.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,3 @@ oneOf:
2323
$ref: '#/components/schemas/Schema'
2424
analysis_title:
2525
type: string
26-
abstract:
27-
type: string

Diff for: spec/components/schemas/DepositResponse.yaml

+26-6
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,48 @@ description: Deposit resource
22
type: object
33
properties:
44
access:
5-
type: array
6-
items:
7-
$ref: '#/components/schemas/Permission'
5+
$ref: '#/components/schemas/Permission'
86
created:
97
type: string
108
format: date-time
119
description: Creation time of record
10+
created_by:
11+
$ref: '#/components/schemas/Email'
12+
experiment:
13+
type: string
14+
description: Experiment that the deposit is associated with
1215
id:
1316
type: string
1417
format: uuid
1518
description: Deposit ID
19+
is_owner:
20+
type: boolean
21+
description: Check if the user that made the request is the owner of the deposit
1622
links:
1723
type: object
24+
description: The related links for this deposit
1825
metadata:
1926
$ref: '#/components/schemas/DepositMetadata'
27+
files:
28+
$ref: '#/components/schemas/FileResponse'
29+
labels:
30+
$ref: '#/components/schemas/Labels'
2031
revision:
2132
type: number
2233
description: Revision of current record
2334
schema:
24-
type: string
25-
format: uri
26-
description: JSON Schema the record is verified against
35+
type: object
36+
properties:
37+
fullname:
38+
type: string
39+
description: The full name of the schema
40+
name:
41+
type: string
42+
description: The short name (`$ana_type`) of the schema
43+
version:
44+
type: string
45+
description: The version of the schema to be used
46+
description: Attributes of the JSON Schema the record is verified against
2747
status:
2848
type: string
2949
enum:

Diff for: spec/components/schemas/DepositSearchResponse.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
description: Response from searching
2+
type: object
3+
properties:
4+
aggregations:
5+
type: object
6+
description: Aggregations and search facets of returned results (used in UI)
7+
hits:
8+
type: object
9+
properties:
10+
hits:
11+
type: array
12+
items:
13+
$ref: '#/components/schemas/DepositResponse'
14+
total:
15+
type: number
16+
description: Total number of results
17+
links:
18+
type: object
19+
description: 'Links related with the deposits results (e.g. prev/next page, self)'

Diff for: spec/components/schemas/Email.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
description: User email address
22
type: string
3-
format: test
43

Diff for: spec/components/schemas/FileResponse.yaml

+17-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
{}
1+
description: Files associated with a deposit
2+
type: array
3+
items:
4+
type: object
5+
properties:
6+
filename:
7+
type: string
8+
description: The full name of the file
9+
filesize:
10+
type: string
11+
description: The size of the file in bytes
12+
checksum:
13+
type: string
14+
description: The SHA1 of the file
15+
id:
16+
type: string
17+
description: The internal id of the file

Diff for: spec/components/schemas/Labels.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
description: Labels associated with a deposit
2+
type: array
3+
items:
4+
type: string

Diff for: spec/components/schemas/Permission.yaml

+12-11
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ type: object
22
properties:
33
action:
44
description: Permission action
5-
type: string
6-
example: deposit-read
7-
identity:
8-
$ref: '#/components/schemas/Email'
9-
type:
10-
description: Permission action
11-
type: string
12-
example: user
13-
enum:
14-
- user
15-
- egroup
5+
type: object
6+
properties:
7+
roles:
8+
type: array
9+
description: Egroups with access
10+
items:
11+
$ref: '#/components/schemas/Email'
12+
users:
13+
type: array
14+
description: Users with access
15+
items:
16+
$ref: '#/components/schemas/Email'

Diff for: spec/components/schemas/PermissionRequest.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
type: array
2+
items:
3+
type: object
4+
properties:
5+
email:
6+
type: string
7+
type:
8+
type: string
9+
op:
10+
type: string
11+
action:
12+
type: string

0 commit comments

Comments
 (0)