-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathswagger.yaml
593 lines (591 loc) · 15.2 KB
/
swagger.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
swagger: '2.0'
info:
description: This is the API for OpenAPI space.
version: 1.0.0
title: OpenAPI space
contact:
name: APInf Oy
url: 'http://apinf.org'
email: [email protected]
host: openapi.space
basePath: /api/v1
tags:
- name: APIs
description: Operations for APIs
- name: Auth
description: Operations for authentication
schemes:
- https
produces:
- application/json
consumes:
- application/json
paths:
/auth/login:
post:
tags:
- Auth
summary: Log in to OpenAPI space
description: ''
x-swagger-router-controller: space.routes.auth
operationId: login
parameters:
- name: body
in: body
description: the user credentials
schema:
$ref: "#/definitions/Credentials"
responses:
'200':
description: login successful
schema:
$ref: "#/definitions/LoginToken"
'401':
description: invalid password
'404':
description: user not found
/auth/login/apinf_token:
post:
tags:
- Auth
summary: Log in to OpenAPI space using an APInf authentication token
description: ''
x-swagger-router-controller: space.routes.auth
operationId: login_apinf_token
parameters:
- name: body
in: body
description: the APInf authentication token and user ID
schema:
type: object
required:
- user_id
- auth_token
properties:
user_id:
type: string
auth_token:
type: string
responses:
'200':
description: login successful
schema:
$ref: "#/definitions/LoginToken"
'401':
description: invalid user ID or auth token
/auth/login/apinf:
post:
tags:
- Auth
summary: Log in to OpenAPI space using an APInf account
description: ''
x-swagger-router-controller: space.routes.auth
operationId: login_apinf
parameters:
- name: body
in: body
description: the APInf username and password
schema:
type: object
required:
- username
- password
properties:
username:
type: string
password:
type: string
responses:
'200':
description: login successful
schema:
$ref: "#/definitions/LoginToken"
'401':
description: invalid username or password
/auth/logout:
post:
tags:
- Auth
summary: Log out from OpenAPI space
description: ''
x-swagger-router-controller: space.routes.auth
operationId: logout
responses:
'200':
description: logout successful
'403':
description: user was not logged in
security:
- AuthToken: []
/auth/register:
post:
tags:
- Auth
summary: Register to OpenAPI space
description: ''
x-swagger-router-controller: space.routes.auth
operationId: register
parameters:
- name: body
in: body
description: registration details
schema:
$ref: "#/definitions/Registration"
responses:
'200':
description: registration successful
schema:
$ref: "#/definitions/LoginToken"
'409':
description: username or email taken
schema:
type: string
description: defines which field is already in use
enum:
- EMAIL
- USERNAME
/auth/ping:
post:
tags:
- Auth
summary: Check whether or not you are authenticated
description: ''
x-swagger-router-controller: space.routes.auth
operationId: ping
responses:
'200':
description: logged in
schema:
$ref: "#/definitions/Registration"
'403':
description: not logged in
security:
- AuthToken: []
/apis:
get:
tags:
- APIs
summary: Retrieves a list of currently defined APIs in API meta list format.
description: ''
x-swagger-router-controller: space.routes.apis
operationId: search_apis
parameters:
- name: query
in: query
description: free text query to match
required: false
default: ''
type: string
- name: limit
in: query
description: the maximum number of APIs to return
required: false
default: 10
type: integer
- name: offset
in: query
description: the offset where to start from when fetching a limited number of APIs
required: false
default: 0
type: integer
- name: sort
in: query
description: |
sort criteria or result set
* NAME -
* UPATED
* CREATED
* OWNER
required: false
type: string
default: NAME
enum:
- NAME
- UPDATED
- CREATED
- OWNER
- name: order
in: query
description: sort order
required: false
type: string
default: ASC
enum:
- ASC
- DESC
responses:
'200':
description: a list of APIs in API meta list format
schema:
$ref: "#/definitions/APIMetaList"
security:
- AuthToken: []
'/apis/{owner}':
get:
tags:
- APIs
summary: Retrieves an API meta listing of all APIs defined for this owner
description: ''
x-swagger-router-controller: space.routes.apis
operationId: get_owner_apis
parameters:
- name: owner
in: path
description: API owner identifier
required: true
type: string
- name: sort
in: query
description: |
sort criteria or result set
* NAME -
* UPATED
* CREATED
* OWNER
required: false
type: string
default: NAME
enum:
- NAME
- UPDATED
- CREATED
- OWNER
- name: order
in: query
description: sort order
required: false
type: string
default: ASC
enum:
- ASC
- DESC
responses:
'200':
description: a list of APIs in API meta list format
schema:
$ref: '#/definitions/APIMetaList'
security:
- AuthToken: []
'/apis/{owner}/{api}':
get:
tags:
- APIs
summary: >-
Retrieves an API meta listing for all API versions for this owner and
API
x-swagger-router-controller: space.routes.apis
operationId: get_api_versions
parameters:
- name: owner
in: path
description: API owner identifier
required: true
type: string
- name: api
in: path
description: API identifier
required: true
type: string
responses:
'200':
description: a list of API versions in API meta format
schema:
$ref: '#/definitions/APIMetaList'
security:
- AuthToken: []
post:
tags:
- APIs
summary: Saves the provided Swagger definition
description: >-
Saves the provided Swagger definition; the owner must match the token
owner. The version will be extracted from the Swagger definitions
itself.
x-swagger-router-controller: space.routes.apis
operationId: save_definition
consumes:
- application/json
parameters:
- name: owner
in: path
description: API owner identifier
required: true
type: string
- name: api
in: path
description: API identifier
required: true
type: string
- name: private
in: query
description: Defines whether the API has to be private
required: false
type: boolean
default: false
- in: body
name: definition
description: the Swagger definition of this API
required: true
schema:
type: object
- name: force
in: query
description: force update
required: false
type: boolean
default: false
responses:
'200':
description: the API was successfully saved
schema:
$ref: "#/definitions/APIMeta"
'201':
description: new API was successfully saved
schema:
$ref: "#/definitions/APIMeta"
'400':
description: the Swagger definition was invalid
'403':
description: the API is not owned by the user
'409':
description: can not overwrite a published API version without force=true
'415':
description: invalid content type
security:
- AuthToken: []
delete:
tags:
- APIs
summary: Deletes the specified API
description: ''
x-swagger-router-controller: space.routes.apis
operationId: delete_api
parameters:
- name: owner
in: path
description: API owner identifier
required: true
type: string
- name: api
in: path
description: API identifier
required: true
type: string
responses:
'200':
description: the API was successfully deleted
schema:
$ref: "#/definitions/APIMetaList"
'403':
description: access denied
'404':
description: specified API not found
security:
- AuthToken: []
'/apis/{owner}/{api}/{version}':
post:
tags:
- APIs
summary: Publish a particular version of the specified API
description: ''
x-swagger-router-controller: space.routes.apis
operationId: publish_api_version
parameters:
- name: owner
in: path
description: API owner identifier
required: true
type: string
- name: api
in: path
description: API identifier
required: true
type: string
- name: version
in: path
description: version identifier
required: true
type: string
responses:
'200':
description: the API version was successfully published
'403':
description: access denied
'404':
description: specified API not found
'409':
description: the API version is already published
delete:
tags:
- APIs
summary: Deletes a particular version of the specified API
description: ''
x-swagger-router-controller: space.routes.apis
operationId: delete_api_version
parameters:
- name: owner
in: path
description: API owner identifier
required: true
type: string
- name: api
in: path
description: API identifier
required: true
type: string
- name: version
in: path
description: version identifier
required: true
type: string
responses:
'200':
description: the API version was successfully deleted
schema:
$ref: "#/definitions/APIMeta"
'403':
description: access denied
'404':
description: specified API not found
'409':
description: the API version is the only version of this API
security:
- AuthToken: []
'/apis/{owner}/{api}/{version}/swagger.json':
get:
tags:
- APIs
summary: >-
Retrieves the Swagger definition for the specified API and version in
JSON format
description: ''
x-swagger-router-controller: space.routes.apis
operationId: get_json_definition
parameters:
- name: owner
in: path
description: API owner identifier
required: true
type: string
- name: api
in: path
description: API identifier
required: true
type: string
- name: version
in: path
description: version identifier
required: true
type: string
responses:
'200':
description: the Swagger API in JSON format
schema:
type: object
properties: {}
'403':
description: "access denied: api is private"
'404':
description: specified API not found
security:
- AuthToken: []
'/apis/{owner}/{api}/{version}/swagger.yaml':
get:
tags:
- APIs
summary: >-
Retrieves the Swagger definition for the specified API and version in
YAML format
description: ''
x-swagger-router-controller: space.routes.apis
operationId: get_yaml_definition
produces:
- text/vnd.yaml
parameters:
- name: owner
in: path
description: API owner identifier
required: true
type: string
- name: api
in: path
description: API identifier
required: true
type: string
- name: version
in: path
description: version identifier
required: true
type: string
responses:
'200':
description: the Swagger API in YAML format
schema:
type: object
properties: {}
'403':
description: "access denied: api is private"
'404':
description: specified API not found
security:
- AuthToken: []
securityDefinitions:
AuthToken:
type: apiKey
name: Authorization
in: header
definitions:
Credentials:
type: object
required:
- username
- password
properties:
username:
type: string
password:
type: string
Registration:
allOf:
- $ref: "#/definitions/Credentials"
- type: object
required:
- email
properties:
email:
type: string
LoginToken:
type: object
properties:
token:
description: The authentication token sent from the server after a successful login
type: string
username:
type: string
APIMeta:
type: object
properties:
owner:
type: string
name:
type: string
description:
type: string
versions:
type: array
url:
type: string
format: url
created:
type: string
format: date-time
modified:
type: string
format: date-time
swagger:
type: object
description: An optional Swagger spec. Not included in meta lists.
APIMetaList:
type: array
items:
$ref: "#/definitions/APIMeta"