Skip to content

Commit b1edeca

Browse files
authored
Merge pull request #1073 from scitran/swagger-fix-undocumented
Document missing and under-documented endpoints
2 parents dbb909d + 38d9a38 commit b1edeca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1758
-231
lines changed

api/config.py

+6
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,23 @@ def apply_env_variables(config):
160160
'file.json',
161161
'file-list.json',
162162
'file-update.json',
163+
'gear.json',
163164
'group-new.json',
164165
'group-update.json',
165166
'info_update.json',
167+
'job-logs.json',
168+
'job-new.json',
166169
'note.json',
167170
'packfile.json',
168171
'permission.json',
169172
'project.json',
170173
'project-template.json',
171174
'project-update.json',
175+
'propose-batch.json',
176+
'resolver.json',
172177
'rule-new.json',
173178
'rule-update.json',
179+
'search-query.json',
174180
'session.json',
175181
'session-update.json',
176182
'subject.json',

swagger/examples/gear_full.json

-37
This file was deleted.

swagger/examples/gears_list_just_name.json

-11
This file was deleted.

swagger/examples/input/job-new.json

-20
This file was deleted.

swagger/examples/output/analysis.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
}
4444
},
4545
"attempt": 1,
46-
"name": "cortex-demo",
4746
"tags": ["ad-hoc", "cortex-demo", "analysis"],
4847
"destination": {
4948
"type": "analysis",
@@ -81,7 +80,8 @@
8180
"created": "2016-10-18T17:45:11.816000+00:00",
8281
"state": "complete",
8382
"config": {},
84-
"id": "58065fa7e5dc5b001457a882"
83+
"id": "58065fa7e5dc5b001457a882",
84+
"gear_id": "58065fa7e5dc5b001457a882"
8585
},
8686
"_id": "58065fa7e5dc5b001457a881"
8787
}
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[{
2+
"category": "converter",
3+
"gear": {
4+
"inputs": {
5+
"audio": {
6+
"base": "file",
7+
"description": "Any audio file. Plain speech suggested!"
8+
}
9+
},
10+
"maintainer": "Nathaniel Kofalt",
11+
"description": "Detects the speech content of an audio file, using the machine-learning DeepSpeech library by Mozilla.",
12+
"license": "Other",
13+
"author": "Nathaniel Kofalt",
14+
"url": "",
15+
"label": "Speech Recognition",
16+
"source": "https://github.com/mozilla/DeepSpeech",
17+
"version": "1",
18+
"custom": {
19+
"gear-builder": {
20+
"image": "gear-builder-kdfqapbezk-20171219165918",
21+
"container": "c15189b625a0ea450cafbb24ef0df03c26cc8cf151181976ec4289801e191032"
22+
}
23+
},
24+
"config": {},
25+
"name": "speech-recognition"
26+
},
27+
"created": "2017-12-20T00:09:50.381000+00:00",
28+
"exchange": {
29+
"git-commit": "local",
30+
"rootfs-hash": "sha384:e01d925f90b097b554be0f802ef6ebb9f07000d7a6a2a0c3a25dac26893d4ac2414381e2c8e60f4b58b27c7fe8e56099",
31+
"rootfs-url": "/api/gears/temp/5a39aa4e07a393001b663910"
32+
},
33+
"modified": "2017-12-20T00:09:50.381000+00:00",
34+
"_id": "5a39aa4e07a393001b663910"
35+
}]

swagger/examples/output/gear.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"category": "converter",
3+
"gear": {
4+
"inputs": {
5+
"audio": {
6+
"base": "file",
7+
"description": "Any audio file. Plain speech suggested!"
8+
}
9+
},
10+
"maintainer": "Nathaniel Kofalt",
11+
"description": "Detects the speech content of an audio file, using the machine-learning DeepSpeech library by Mozilla.",
12+
"license": "Other",
13+
"author": "Nathaniel Kofalt",
14+
"url": "",
15+
"label": "Speech Recognition",
16+
"source": "https://github.com/mozilla/DeepSpeech",
17+
"version": "1",
18+
"custom": {
19+
"gear-builder": {
20+
"image": "gear-builder-kdfqapbezk-20171219165918",
21+
"container": "c15189b625a0ea450cafbb24ef0df03c26cc8cf151181976ec4289801e191032"
22+
}
23+
},
24+
"config": {},
25+
"name": "speech-recognition"
26+
},
27+
"created": "2017-12-20T00:09:50.381000+00:00",
28+
"exchange": {
29+
"git-commit": "local",
30+
"rootfs-hash": "sha384:e01d925f90b097b554be0f802ef6ebb9f07000d7a6a2a0c3a25dac26893d4ac2414381e2c8e60f4b58b27c7fe8e56099",
31+
"rootfs-url": "/api/gears/temp/5a39aa4e07a393001b663910"
32+
},
33+
"modified": "2017-12-20T00:09:50.381000+00:00",
34+
"_id": "5a39aa4e07a393001b663910"
35+
}

swagger/examples/output/rule.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"_id": "5a12f2923306be0016179f47",
3+
"name": "dcm2niix",
4+
"alg": "dcm2niix",
5+
"any": [],
6+
"all": [
7+
{
8+
"regex": true,
9+
"type": "file.measurements",
10+
"value": "^(?!non-image).+$"
11+
},
12+
{
13+
"type": "file.type",
14+
"value": "nifti"
15+
}
16+
]
17+
}

swagger/index.yaml

+22-12
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,42 @@ consumes:
1212
- 'application/json'
1313

1414
tags:
15-
- name: files
16-
description: File upload/download operations
17-
- name: devices
18-
description: Device operations
1915
- name: users
2016
description: User operations
21-
- name: gears
22-
description: Gear operations
2317
- name: groups
2418
description: Group operations
25-
- name: jobs
26-
description: Job operations
27-
- name: collections
28-
description: Collection operations
19+
- name: projects
20+
description: Project operations
2921
- name: sessions
3022
description: Session operations
3123
- name: acquisitions
3224
description: Acquisition operations
33-
- name: projects
34-
description: Project operations
25+
- name: analyses
26+
description: Analysis operations
27+
- name: collections
28+
description: Collection operations
29+
- name: files
30+
description: File upload/download operations
31+
- name: devices
32+
description: Device operations
33+
- name: gears
34+
description: Gear operations
35+
- name: rules
36+
description: Gear rule configuration
37+
- name: jobs
38+
description: Job operations
3539
- name: reports
3640
description: Site-wide reports
3741
- name: batch
3842
description: Batch job operations
43+
- name: default
3944

4045
paths:
4146
$include:
4247
- paths/login.yaml
4348
- paths/download.yaml
4449
- paths/upload-by-label.yaml
50+
- paths/upload-by-reaper.yaml
4551
- paths/upload-by-uid.yaml
4652
- paths/upload-match-uid.yaml
4753
- paths/clean-packfiles.yaml
@@ -60,6 +66,10 @@ paths:
6066
- paths/projects.yaml
6167
- paths/report.yaml
6268
- paths/batch.yaml
69+
- paths/analyses.yaml
70+
- paths/site-rules.yaml
71+
- paths/dataexplorer.yaml
72+
- paths/resolver.yaml
6373

6474

6575
securityDefinitions:

swagger/paths/acquisitions.yaml

+9-8
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,22 @@ $template_arguments:
1717
delete-description: Read-write project permissions are required to delete an acquisition. </br>Admin project permissions are required if the acquisition contains data uploaded by sources other than users and jobs.
1818

1919

20+
/acquisitions/{AcquisitionId}/info:
21+
$template: templates/container-item-info.yaml
22+
2023
# ===== Tags =====
2124
/acquisitions/{AcquisitionId}/tags:
2225
$template: templates/tags.yaml
2326
/acquisitions/{AcquisitionId}/tags/{TagValue}:
2427
$template: templates/tags-tag.yaml
2528

26-
# ===== Packfile =====
27-
/acquisitions/{AcquisitionId}/packfile-start:
28-
$template: templates/packfile-start.yaml
29-
/acquisitions/{AcquisitionId}/packfile:
30-
$template: templates/packfile.yaml
31-
/acquisitions/{AcquisitionId}/packfile-end:
32-
$template: templates/packfile-end.yaml
33-
3429
# ===== Files =====
3530
/acquisitions/{AcquisitionId}/files:
3631
$template: templates/file-list-upload.yaml
3732
/acquisitions/{AcquisitionId}/files/{FileName}:
3833
$template: templates/file-item.yaml
34+
/acquisitions/{AcquisitionId}/files/{FileName}/info:
35+
$template: templates/file-item-info.yaml
3936

4037
# ===== Notes =====
4138
/acquisitions/{AcquisitionId}/notes:
@@ -46,8 +43,12 @@ $template_arguments:
4643
# ===== Analyses =====
4744
/acquisitions/{AcquisitionId}/analyses:
4845
$template: templates/analyses-list.yaml
46+
arguments:
47+
allowCreate: true
4948
/acquisitions/{AcquisitionId}/analyses/{AnalysisId}:
5049
$template: templates/analysis-item.yaml
50+
arguments:
51+
supportsDelete: true
5152
/acquisitions/{AcquisitionId}/analyses/{AnalysisId}/inputs:
5253
$template: templates/analysis-files.yaml
5354
arguments:

swagger/paths/analyses.yaml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
$template_arguments:
2+
tag: 'analyses'
3+
4+
/analyses/{AnalysisId}:
5+
$template: templates/analysis-item.yaml
6+
arguments:
7+
supportsDelete: false
8+
9+
/analyses/{AnalysisId}/inputs:
10+
$template: templates/analysis-files.yaml
11+
arguments:
12+
filegroup: inputs
13+
14+
/analyses/{AnalysisId}/inputs/{Filename}:
15+
$template: templates/analysis-files-create-ticket-filename.yaml
16+
arguments:
17+
filegroup: inputs
18+
19+
/analyses/{AnalysisId}/files:
20+
$template: templates/analysis-files.yaml
21+
arguments:
22+
filegroup: outputs
23+
24+
/analyses/{AnalysisId}/files/{Filename}:
25+
$template: templates/analysis-files-create-ticket-filename.yaml
26+
arguments:
27+
filegroup: outputs
28+
29+
/{ContainerName}/{ContainerId}/{SubcontainerName}/analyses:
30+
parameters:
31+
- name: ContainerName
32+
in: path
33+
type: string
34+
required: true
35+
enum:
36+
- groups
37+
- projects
38+
- sessions
39+
- acquisitions
40+
- collections
41+
description: The parent container type
42+
- name: ContainerId
43+
in: path
44+
type: string
45+
required: true
46+
description: The parent container id
47+
- name: SubcontainerName
48+
in: path
49+
type: string
50+
required: true
51+
enum:
52+
- all
53+
- projects
54+
- sessions
55+
- acquisitions
56+
description: The sub container type
57+
get:
58+
summary: Get nested analyses for a container
59+
description: >
60+
Returns analyses that belong to containers of the specified type that belong
61+
to ContainerId.
62+
63+
For example: `projects/{ProjectId}/acquisitions/analyses` will return any analyses
64+
that have an acquisition that is under that project as a parent.
65+
66+
The `all` keyword is also supported, for example: projects/{ProjectId}/all/analyses
67+
will return any analyses that have any session or acquisition or the project itself as a parent.
68+
operationId: get_analyses
69+
tags:
70+
- analyses
71+
responses:
72+
'200':
73+
description: The list of analyses
74+
schema:
75+
$ref: schemas/output/analyses-list.json
76+

0 commit comments

Comments
 (0)