-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yaml
506 lines (506 loc) · 13 KB
/
openapi.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
openapi: 3.0.0
info:
version: 1.0.0
title: Set and Tune API
description: API for managing sets and tunes
servers:
- url: 'https://localhost:8080'
paths:
/:
get:
summary: Welcome to the Set and Tune API
operationId: home
responses:
'200':
description: Welcome message
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
/health:
get:
summary: Check the health of the service
operationId: health
responses:
'200':
$ref: '#/components/responses/Health'
'503':
description: Service Unavailable
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
/tunes:
get:
summary: List all tunes
operationId: listTunes
responses:
'200':
description: A list of tunes
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Tune'
default:
$ref: '#/components/responses/Error'
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
post:
summary: Create a new tune
operationId: createTune
requestBody:
description: Tune object to be created
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateTune'
responses:
'201':
description: The created tune
content:
application/json:
schema:
$ref: '#/components/schemas/Tune'
'400':
$ref: '#/components/responses/InvalidInput'
default:
$ref: '#/components/responses/Error'
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
'/tunes/{tuneId}':
get:
summary: Get a tune by ID
operationId: getTune
parameters:
- $ref: '#/components/parameters/tuneId'
responses:
'200':
description: The requested tune
content:
application/json:
schema:
$ref: '#/components/schemas/Tune'
'404':
$ref: '#/components/responses/NotFound'
default:
$ref: '#/components/responses/Error'
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
put:
summary: Update a tune by ID
operationId: updateTune
parameters:
- $ref: '#/components/parameters/tuneId'
requestBody:
description: Tune object to be updated
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateTune'
responses:
'204':
description: The tune was updated
'404':
$ref: '#/components/responses/NotFound'
default:
$ref: '#/components/responses/Error'
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
delete:
summary: Delete a tune by ID
operationId: deleteTune
parameters:
- $ref: '#/components/parameters/tuneId'
responses:
'204':
description: Tune deleted
'404':
$ref: '#/components/responses/NotFound'
default:
$ref: '#/components/responses/Error'
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
/sets:
get:
summary: List all sets
operationId: listSets
responses:
'200':
description: A list of sets
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/MusicSet'
default:
$ref: '#/components/responses/Error'
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
post:
summary: Create a new set
operationId: createSet
requestBody:
description: Set object to be created
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateSet'
responses:
'201':
description: The created set
content:
application/json:
schema:
$ref: '#/components/schemas/MusicSet'
'400':
$ref: '#/components/responses/InvalidInput'
default:
$ref: '#/components/responses/Error'
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
'/sets/{setId}':
get:
summary: Get a set by ID
operationId: getSet
parameters:
- $ref: '#/components/parameters/setId'
responses:
'200':
description: The requested set
content:
application/json:
schema:
$ref: '#/components/schemas/MusicSet'
'404':
$ref: '#/components/responses/NotFound'
default:
$ref: '#/components/responses/Error'
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
put:
summary: Update a set by ID
operationId: updateSet
parameters:
- $ref: '#/components/parameters/setId'
requestBody:
description: Set object to be updated
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateSet'
responses:
'204':
description: The updated set
'404':
$ref: '#/components/responses/NotFound'
default:
$ref: '#/components/responses/Error'
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
delete:
summary: Delete a set by ID
operationId: deleteSet
parameters:
- $ref: '#/components/parameters/setId'
responses:
'204':
description: Set deleted
'404':
$ref: '#/components/responses/NotFound'
default:
$ref: '#/components/responses/Error'
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
'/sets/{setId}/tunes':
put:
summary: Assign tunes to a set
operationId: assignTunesToSet
parameters:
- $ref: '#/components/parameters/setId'
requestBody:
description: Array of tune IDs which should be the tunes of the set
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TuneIdList'
responses:
'200':
description: The updated set
content:
application/json:
schema:
$ref: '#/components/schemas/MusicSet'
'404':
$ref: '#/components/responses/NotFound'
default:
$ref: '#/components/responses/Error'
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
/imports:
post:
summary: Import tunes/sets from a file
operationId: importFile
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
responses:
'201':
$ref: '#/components/responses/Import'
default:
$ref: '#/components/responses/Error'
security:
- ApiKeyAuth: []
servers:
- url: 'https://localhost:8080'
components:
parameters:
tuneId:
name: tuneId
in: path
required: true
schema:
type: string
format: uuid
setId:
name: setId
in: path
required: true
schema:
type: string
format: uuid
securitySchemes:
ApiKeyAuth:
type: apiKey
name: X-API-KEY
in: header
responses:
Error:
description: General error for the service
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
InvalidInput:
description: Invalid input
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
NotFound:
description: Unable to find resource
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Import:
description: Information about an import of one file
content:
application/json:
schema:
$ref: '#/components/schemas/ImportFile'
Health:
description: Health response
content:
application/json:
schema:
type: object
properties:
status:
$ref: '#/components/schemas/HealthStatus'
details:
type: object
properties:
database:
type: object
properties:
status:
$ref: '#/components/schemas/HealthStatus'
timestamp:
type: string
format: date-time
x-examples:
Example 1:
status: up
details:
database:
status: up
timestamp: '2024-07-21T13:14:18.973593348Z'
schemas:
Tune:
allOf:
- $ref: '#/components/schemas/ObjectId'
- $ref: '#/components/schemas/TuneProperties'
ObjectId:
type: object
properties:
id:
$ref: '#/components/schemas/Id'
required:
- id
Id:
type: string
description: Unique identifier for an object
format: uuid
TuneProperties:
type: object
properties:
title:
type: string
type:
type: string
timeSig:
type: string
composer:
type: string
arranger:
type: string
required:
- title
CreateTune:
allOf:
- $ref: '#/components/schemas/TuneProperties'
UpdateTune:
allOf:
- $ref: '#/components/schemas/TuneProperties'
MusicSet:
description: Called MusicSet and not only Set because of name clash in e.g. typescript
allOf:
- $ref: '#/components/schemas/ObjectId'
- $ref: '#/components/schemas/SetProperties'
SetProperties:
type: object
allOf:
- $ref: '#/components/schemas/BasicSetProperties'
- type: object
properties:
tunes:
type: array
items:
$ref: '#/components/schemas/Tune'
BasicSetProperties:
type: object
properties:
title:
type: string
description: The name of the Set
description:
type: string
description: A description of the Set
creator:
type: string
description: The name of the creator of the set
required:
- title
CreateSet:
allOf:
- $ref: '#/components/schemas/CreateUpdateSetProperties'
CreateUpdateSetProperties:
type: object
allOf:
- $ref: '#/components/schemas/BasicSetProperties'
- type: object
properties:
tunes:
$ref: '#/components/schemas/TuneIdList'
TuneIdList:
type: array
items:
$ref: '#/components/schemas/Id'
example:
- e4635d0e-3101-4c7e-a84b-7271dea0834e
- d8686947-5e7b-4d26-b7e6-cbaaded2405a
- a243cd85-45fb-4940-bad6-549cab3f096f
UpdateSet:
allOf:
- $ref: '#/components/schemas/CreateUpdateSetProperties'
Error:
type: object
properties:
message:
type: string
required:
- message
ImportFile:
type: object
properties:
name:
type: string
description: the imported filename
set:
$ref: '#/components/schemas/BasicMusicSet'
tunes:
type: array
description: 'if import was successful, the array of imported tunes'
items:
$ref: '#/components/schemas/ImportTune'
required:
- name
BasicMusicSet:
allOf:
- $ref: '#/components/schemas/ObjectId'
- $ref: '#/components/schemas/BasicSetProperties'
ImportTune:
allOf:
- $ref: '#/components/schemas/Tune'
- $ref: '#/components/schemas/ImportInfo'
ImportInfo:
type: object
title: ImportInfo
properties:
warnings:
type: array
items:
type: string
errors:
type: array
items:
type: string
infos:
type: array
items:
type: string
HealthStatus:
type: string
enum:
- up
- down
title: HealthStatus
readOnly: true
security:
- ApiKeyAuth: []