-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
713 lines (712 loc) · 23.2 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
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
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
openapi: 3.1.0
info:
title: Redocly Museum API
description: Imaginary, but delightful Museum API for interacting with museum services and information. Built with love by Redocly.
version: 1.1.1
termsOfService: 'https://redocly.com/subscription-agreement/'
contact:
email: [email protected]
url: "https://redocly.com/docs/cli/"
license:
name: MIT
url: "https://opensource.org/license/mit/"
servers:
- url: "https://api.fake-museum-example.com/v1.1"
paths:
/museum-hours:
get:
summary: Get museum hours
description: Get upcoming museum operating hours.
operationId: getMuseumHours
tags:
- Operations
parameters:
- $ref: "#/components/parameters/StartDate"
- $ref: "#/components/parameters/PaginationPage"
- $ref: "#/components/parameters/PaginationLimit"
responses:
"200":
description: Success.
content:
application/json:
schema:
$ref: "#/components/schemas/GetMuseumHoursResponse"
examples:
default_example:
$ref: "#/components/examples/GetMuseumHoursResponseExample"
"400":
$ref: '#/components/responses/BadRequest'
"404":
$ref: '#/components/responses/NotFound'
/special-events:
post:
summary: Create special events
description: Creates a new special event for the museum.
operationId: createSpecialEvent
tags:
- Events
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateSpecialEventRequest"
examples:
default_example:
$ref: "#/components/examples/CreateSpecialEventRequestExample"
responses:
"201":
description: Created.
content:
application/json:
schema:
$ref: "#/components/schemas/SpecialEventResponse"
examples:
default_example:
$ref: "#/components/examples/CreateSpecialEventResponseExample"
"400":
$ref: '#/components/responses/BadRequest'
"404":
$ref: '#/components/responses/NotFound'
get:
summary: List special events
description: Return a list of upcoming special events at the museum.
operationId: listSpecialEvents
tags:
- Events
parameters:
- $ref: "#/components/parameters/StartDate"
- $ref: "#/components/parameters/EndDate"
- $ref: "#/components/parameters/PaginationPage"
- $ref: "#/components/parameters/PaginationLimit"
responses:
"200":
description: Success.
content:
application/json:
schema:
$ref: "#/components/schemas/ListSpecialEventsResponse"
examples:
default_example:
$ref: "#/components/examples/ListSpecialEventsResponseExample"
"400":
$ref: '#/components/responses/BadRequest'
"404":
$ref: '#/components/responses/NotFound'
/special-events/{eventId}:
get:
summary: Get special event
description: Get details about a special event.
operationId: getSpecialEvent
tags:
- Events
parameters:
- $ref: "#/components/parameters/EventId"
responses:
"200":
description: Success.
content:
application/json:
schema:
$ref: "#/components/schemas/SpecialEventResponse"
examples:
default_example:
$ref: "#/components/examples/GetSpecialEventResponseExample"
"400":
$ref: '#/components/responses/BadRequest'
"404":
$ref: '#/components/responses/NotFound'
patch:
summary: Update special event
description: Update the details of a special event.
operationId: updateSpecialEvent
tags:
- Events
parameters:
- $ref: "#/components/parameters/EventId"
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UpdateSpecialEventRequest"
examples:
default_example:
$ref: "#/components/examples/UpdateSpecialEventRequestExample"
responses:
"200":
description: Success.
content:
application/json:
schema:
$ref: "#/components/schemas/SpecialEventResponse"
examples:
default_example:
$ref: "#/components/examples/UpdateSpecialEventResponseExample"
"400":
$ref: '#/components/responses/BadRequest'
"404":
$ref: '#/components/responses/NotFound'
delete:
summary: Delete special event
description: Delete a special event from the collection. Allows museum to cancel planned events.
operationId: deleteSpecialEvent
tags:
- Events
parameters:
- $ref: "#/components/parameters/EventId"
responses:
"204":
description: Success - no content.
"400":
$ref: '#/components/responses/BadRequest'
"401":
$ref: '#/components/responses/Unauthorized'
"404":
$ref: '#/components/responses/NotFound'
/tickets:
post:
summary: Buy museum tickets
description: Purchase museum tickets for general entry or special events.
operationId: buyMuseumTickets
tags:
- Tickets
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/BuyMuseumTicketsRequest"
examples:
general_entry:
$ref: "#/components/examples/BuyGeneralTicketsRequestExample"
event_entry:
$ref: "#/components/examples/BuyEventTicketsRequestExample"
responses:
"201":
description: Created.
content:
application/json:
schema:
$ref: "#/components/schemas/BuyMuseumTicketsResponse"
examples:
general_entry:
$ref: "#/components/examples/BuyGeneralTicketsResponseExample"
event_entry:
$ref: "#/components/examples/BuyEventTicketsResponseExample"
"400":
$ref: '#/components/responses/BadRequest'
"404":
$ref: '#/components/responses/NotFound'
/tickets/{ticketId}/qr:
get:
summary: Get ticket QR code
description: Return an image of your ticket with scannable QR code. Used for event entry.
operationId: getTicketCode
tags:
- Tickets
parameters:
- $ref: "#/components/parameters/TicketId"
responses:
"200":
description: Scannable event ticket in image format.
content:
image/png:
schema:
$ref: "#/components/schemas/GetTicketCodeResponse"
"400":
$ref: '#/components/responses/BadRequest'
"404":
$ref: '#/components/responses/NotFound'
components:
schemas:
TicketType:
description: Type of ticket being purchased. Use `general` for regular museum entry and `event` for tickets to special events.
type: string
enum:
- event
- general
example: event
Date:
type: string
format: date
example: '2023-10-29'
Email:
description: Email address for ticket purchaser.
type: string
format: email
example: [email protected]
Phone:
description: Phone number for the ticket purchaser (optional).
type: string
example: '+1(234)-567-8910'
BuyMuseumTicketsRequest:
description: Request payload used for purchasing museum tickets.
type: object
properties:
ticketType:
$ref: "#/components/schemas/TicketType"
eventId:
description: Unique identifier for a special event. Required if purchasing tickets for the museum's special events.
$ref: "#/components/schemas/EventId"
ticketDate:
description: Date that the ticket is valid for.
$ref: "#/components/schemas/Date"
email:
$ref: "#/components/schemas/Email"
phone:
$ref: "#/components/schemas/Phone"
required:
- ticketType
- ticketDate
- email
TicketMessage:
description: Confirmation message after a ticket purchase.
type: string
example: Museum general entry ticket purchased
TicketId:
description: Unique identifier for museum ticket. Generated when purchased.
type: string
format: uuid
example: a54a57ca-36f8-421b-a6b4-2e8f26858a4c
TicketConfirmation:
description: Unique confirmation code used to verify ticket purchase.
type: string
example: 'ticket-event-a98c8f-7eb12'
BuyMuseumTicketsResponse:
description: Details for a museum ticket after a successful purchase.
type: object
properties:
message:
$ref: "#/components/schemas/TicketMessage"
eventName:
$ref: "#/components/schemas/EventName"
ticketId:
$ref: "#/components/schemas/TicketId"
ticketType:
$ref: "#/components/schemas/TicketType"
ticketDate:
description: Date the ticket is valid for.
$ref: "#/components/schemas/Date"
confirmationCode:
$ref: "#/components/schemas/TicketConfirmation"
required:
- message
- ticketId
- ticketType
- ticketDate
- confirmationCode
GetTicketCodeResponse:
description: Image of a ticket with a QR code used for museum or event entry.
type: string
format: binary
GetMuseumHoursResponse:
description: List of museum operating hours for consecutive days.
type: array
items:
$ref: "#/components/schemas/MuseumDailyHours"
MuseumDailyHours:
description: Daily operating hours for the museum.
type: object
properties:
date:
description: Date the operating hours apply to.
$ref: "#/components/schemas/Date"
example: '2024-12-31'
timeOpen:
type: string
pattern: '^([01]\d|2[0-3]):?([0-5]\d)$'
description: Time the museum opens on a specific date. Uses 24 hour time format (`HH:mm`).
example: 09:00
timeClose:
description: Time the museum closes on a specific date. Uses 24 hour time format (`HH:mm`).
type: string
pattern: '^([01]\d|2[0-3]):?([0-5]\d)$'
example: 18:00
required:
- date
- timeOpen
- timeClose
EventId:
description: Identifier for a special event.
type: string
format: uuid
example: 3be6453c-03eb-4357-ae5a-984a0e574a54
EventName:
type: string
description: Name of the special event.
example: Pirate Coding Workshop
EventLocation:
type: string
description: Location where the special event is held.
example: Computer Room
EventDescription:
type: string
description: Description of the special event.
example: Captain Blackbeard shares his love of the C...language. And possibly Arrrrr (R lang).
EventDates:
type: array
items:
$ref: "#/components/schemas/Date"
description: List of planned dates for the special event.
EventPrice:
description: Price of a ticket for the special event.
type: number
format: float
example: 25
CreateSpecialEventRequest:
description: Request payload for creating new special events at the museum.
type: object
properties:
name:
$ref: "#/components/schemas/EventName"
location:
$ref: "#/components/schemas/EventLocation"
eventDescription:
$ref: "#/components/schemas/EventDescription"
dates:
$ref: "#/components/schemas/EventDates"
price:
$ref: "#/components/schemas/EventPrice"
required:
- name
- location
- eventDescription
- dates
- price
UpdateSpecialEventRequest:
description: Request payload for updating an existing special event. Only included fields are updated in the event.
type: object
properties:
name:
$ref: "#/components/schemas/EventName"
location:
$ref: "#/components/schemas/EventLocation"
eventDescription:
$ref: "#/components/schemas/EventDescription"
dates:
$ref: "#/components/schemas/EventDates"
price:
$ref: "#/components/schemas/EventPrice"
ListSpecialEventsResponse:
description: List of upcoming special events.
type: array
items:
$ref: "#/components/schemas/SpecialEventResponse"
SpecialEventResponse:
description: Information about a special event.
type: object
properties:
eventId:
$ref: "#/components/schemas/EventId"
name:
$ref: "#/components/schemas/EventName"
location:
$ref: "#/components/schemas/EventLocation"
eventDescription:
$ref: "#/components/schemas/EventDescription"
dates:
$ref: "#/components/schemas/EventDates"
price:
$ref: "#/components/schemas/EventPrice"
required:
- eventId
- name
- location
- eventDescription
- dates
- price
Error:
type: object
properties:
type:
type: string
example: object
title:
type: string
example: Validation failed
securitySchemes:
MuseumPlaceholderAuth:
type: http
scheme: basic
examples:
BuyGeneralTicketsRequestExample:
summary: General entry ticket
value:
ticketType: general
ticketDate: '2023-09-07'
email: [email protected]
BuyEventTicketsRequestExample:
summary: Special event ticket
value:
ticketType: general
eventId: dad4bce8-f5cb-4078-a211-995864315e39
ticketDate: '2023-09-05'
email: [email protected]
BuyGeneralTicketsResponseExample:
summary: General entry ticket
value:
message: Museum general entry ticket purchased
ticketId: 382c0820-0530-4f4b-99af-13811ad0f17a
ticketType: general
ticketDate: '2023-09-07'
confirmationCode: ticket-general-e5e5c6-dce78
BuyEventTicketsResponseExample:
summary: Special event ticket
value:
message: Museum special event ticket purchased
ticketId: b811f723-17b2-44f7-8952-24b03e43d8a9
eventName: Mermaid Treasure Identification and Analysis
ticketType: event
ticketDate: '2023-09-05'
confirmationCode: ticket-event-9c55eg-8v82a
CreateSpecialEventRequestExample:
summary: Create special event
value:
name: Mermaid Treasure Identification and Analysis
location: Under the seaaa 🦀 🎶 🌊.
eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.
dates:
- '2023-09-05'
- '2023-09-08'
price: 0
CreateSpecialEventResponseExample:
summary: Special event created
value:
eventId: dad4bce8-f5cb-4078-a211-995864315e39
name: Mermaid Treasure Identification and Analysis
location: Under the seaaa 🦀 🎶 🌊.
eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.
dates:
- '2023-09-05'
- '2023-09-08'
price: 30
GetSpecialEventResponseExample:
summary: Get special event
value:
eventId: 6744a0da-4121-49cd-8479-f8cc20526495
name: Time Traveler Tea Party
location: Temporal Tearoom
eventDescription: Sip tea with important historical figures.
dates:
- '2023-11-18'
- '2023-11-25'
- '2023-12-02'
price: 60
ListSpecialEventsResponseExample:
summary: List of special events
value:
- eventId: f3e0e76e-e4a8-466e-ab9c-ae36c15b8e97
name: Sasquatch Ballet
location: Seattle... probably
eventDescription: They're big, they're hairy, but they're also graceful. Come learn how the biggest feet can have the lightest touch.
dates:
- '2023-12-15'
- '2023-12-22'
price: 40
- eventId: 2f14374a-9c65-4ee5-94b7-fba66d893483
name: Solar Telescope Demonstration
location: Far from the sun.
eventDescription: Look at the sun without going blind!
dates:
- '2023-09-07'
- '2023-09-14'
price: 50
- eventId: 6aaa61ba-b2aa-4868-b803-603dbbf7bfdb
name: Cook like a Caveman
location: Fire Pit on East side
eventDescription: Learn to cook on an open flame.
dates:
- '2023-11-10'
- '2023-11-17'
- '2023-11-24'
price: 5
- eventId: 602b75e1-5696-4ab8-8c7a-f9e13580f910
name: Underwater Basket Weaving
location: Rec Center Pool next door.
eventDescription: Learn to weave baskets underwater.
dates:
- '2023-09-12'
- '2023-09-15'
price: 15
- eventId: dad4bce8-f5cb-4078-a211-995864315e39
name: Mermaid Treasure Identification and Analysis
location: Room Sea-12
eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits — kindly donated by Ariel.
dates:
- '2023-09-05'
- '2023-09-08'
price: 30
- eventId: 6744a0da-4121-49cd-8479-f8cc20526495
name: Time Traveler Tea Party
location: Temporal Tearoom
eventDescription: Sip tea with important historical figures.
dates:
- '2023-11-18'
- '2023-11-25'
- '2023-12-02'
price: 60
- eventId: 3be6453c-03eb-4357-ae5a-984a0e574a54
name: Pirate Coding Workshop
location: Computer Room
eventDescription: Captain Blackbeard shares his love of the C...language. And possibly Arrrrr (R lang).
dates:
- '2023-10-29'
- '2023-10-30'
- '2023-10-31'
price: 45
- eventId: 9d90d29a-2af5-4206-97d9-9ea9ceadcb78
name: Llama Street Art Through the Ages
location: Auditorium
eventDescription: Llama street art?! Alpaca my bags -- let's go!
dates:
- '2023-10-29'
- '2023-10-30'
- '2023-10-31'
price: 45
- eventId: a3c7b2c4-b5fb-4ef7-9322-00a919864957
name: The Great Parrot Debate
location: Outdoor Amphitheatre
eventDescription: See leading parrot minds discuss important geopolitical issues.
dates:
- '2023-11-03'
- '2023-11-10'
price: 35
- eventId: b92d46b7-4c5d-422b-87a5-287767e26f29
name: Eat a Bunch of Corn
location: Cafeteria
eventDescription: We accidentally bought too much corn. Please come eat it.
dates:
- '2023-11-10'
- '2023-11-17'
- '2023-11-24'
price: 5
UpdateSpecialEventRequestExample:
summary: Update special event request
value:
location: On the beach.
price: 15
UpdateSpecialEventResponseExample:
summary: Update special event
value:
eventId: dad4bce8-f5cb-4078-a211-995864315e39
name: Mermaid Treasure Identification and Analysis
location: On the beach.
eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.
dates:
- '2023-09-05'
- '2023-09-08'
price: 15
GetMuseumHoursResponseExample:
summary: Get hours response
value:
- date: "2023-09-11"
timeOpen: "09:00"
timeClose: "18:00"
- date: "2023-09-12"
timeOpen: "09:00"
timeClose: "18:00"
- date: "2023-09-13"
timeOpen: "09:00"
timeClose: "18:00"
- date: "2023-09-14"
timeOpen: "09:00"
timeClose: "18:00"
- date: "2023-09-15"
timeOpen: "10:00"
timeClose: "16:00"
- date: "2023-09-18"
timeOpen: "09:00"
timeClose: "18:00"
- date: "2023-09-19"
timeOpen: "09:00"
timeClose: "18:00"
- date: "2023-09-20"
timeOpen: "09:00"
timeClose: "18:00"
- date: "2023-09-21"
timeOpen: "09:00"
timeClose: "18:00"
- date: "2023-09-22"
timeOpen: "10:00"
timeClose: "16:00"
parameters:
PaginationPage:
name: page
in: query
description: Page number to retrieve.
schema:
type: integer
default: 1
example: 2
PaginationLimit:
name: limit
in: query
description: Number of days per page.
schema:
type: integer
default: 10
maximum: 30
example: 15
EventId:
name: eventId
in: path
description: Identifier for a special event.
required: true
schema:
type: string
format: uuid
example: dad4bce8-f5cb-4078-a211-995864315e39
StartDate:
name: startDate
in: query
description: Starting date to retrieve future operating hours from. Defaults to today's date.
schema:
type: string
format: date
example: '2023-02-23'
EndDate:
name: endDate
in: query
description: End of a date range to retrieve special events for. Defaults to 7 days after `startDate`.
schema:
type: string
format: date
example: '2023-04-18'
TicketId:
name: ticketId
in: path
description: Identifier for a ticket to a museum event. Used to generate ticket image.
required: true
schema:
type: string
format: uuid
example: a54a57ca-36f8-421b-a6b4-2e8f26858a4c
responses:
BadRequest:
description: Bad request.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
NotFound:
description: Not found.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: Unauthorized.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
tags:
- name: Operations
description: Operational information about the museum.
- name: Events
description: Special events hosted by the museum.
- name: Tickets
description: Museum tickets for general entrance or special events.
security:
- MuseumPlaceholderAuth: []