/
burgershop.openapi.yaml
553 lines (553 loc) · 16.8 KB
/
burgershop.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
openapi: 3.1.0
info:
title: Burger Shop
description: |
The best burger API at princess beef. You can find the testiest burgers in the world
termsOfService: https://pb33f.io
contact:
name: pb33f
email: buckaroo@pb33f.io
url: https://pb33f.io
license:
name: pb33f
url: https://pb33f.io/made-up
version: "1.2"
security:
- OAuthScheme:
- read:burgers
- write:burgers
tags:
- name: "Burgers"
description: "All kinds of yummy burgers."
externalDocs:
description: "Find out more"
url: "https://pb33f.io"
x-internal-ting: somethingSpecial
x-internal-tong: 1
x-internal-tang: 1.2
x-internal-tung: true
x-internal-arr:
- one
- two
x-internal-arrmap:
- what: now
- why: that
x-something-else:
ok:
- what: now?
- name: "Dressing"
description: "Variety of dressings: cheese, veggie, oil and a lot more"
externalDocs:
description: "Find out more information about our products)"
url: "https://pb33f.io"
servers:
- url: "{scheme}://api.pb33f.io"
description: "this is our main API server, for all fun API things."
variables:
scheme:
enum: [https, wss]
default: https
description: this is a server variable for the scheme
- url: "https://{domain}.{host}.com"
description: "this is our second API server, for all fun API things."
variables:
domain:
default: "api"
description: the default API domain is 'api'
host:
default: "pb33f.io"
description: the default host for this API is 'pb33f.io'
paths:
x-milky-milk: milky
/burgers:
x-burger-meta: meaty
post:
operationId: createBurger
tags:
- "Burgers"
summary: Create a new burger
description: A new burger for our menu, yummy yum yum.
requestBody:
$ref: '#/components/requestBodies/BurgerRequest'
responses:
"200":
headers:
UseOil:
$ref: '#/components/headers/UseOil'
description: A tasty burger for you to eat.
content:
application/json:
schema:
$ref: '#/components/schemas/Burger'
examples:
quarterPounder:
$ref: '#/components/examples/QuarterPounder'
filetOFish:
summary: a cripsy fish sammich filled with ocean goodness.
value:
name: Filet-O-Fish
numPatties: 1
links:
LocateBurger:
$ref: '#/components/links/LocateBurger'
AnotherLocateBurger:
$ref: '#/components/links/AnotherLocateBurger'
"500":
description: Unexpected error creating a new burger. Sorry.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
unexpectedError:
summary: oh my goodness
value:
message: something went terribly wrong my friend, no new burger for you.
"422":
description: Unprocessable entity
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
unexpectedError:
summary: invalid request
value:
message: unable to accept this request, looks bad, missing something.
security:
- OAuthScheme:
- read:burgers
- write:burgers
servers:
- url: https://pb33f.io
description: this is an alternative server for this operation.
/burgers/{burgerId}:
get:
callbacks:
burgerCallback:
$ref: '#/components/callbacks/BurgerCallback'
operationId: locateBurger
tags:
- "Burgers"
summary: Search a burger by ID - returns the burger with that identifier
description: Look up a tasty burger take it and enjoy it
parameters:
- $ref: '#/components/parameters/BurgerId'
- $ref: '#/components/parameters/BurgerHeader'
responses:
"200":
description: A tasty burger for you to eat. Wide variety of products to choose from
content:
application/json:
schema:
$ref: '#/components/schemas/Burger'
examples:
quarterPounder:
$ref: '#/components/examples/QuarterPounder'
filetOFish:
summary: A tasty treat from the sea
value:
name: Filet-O-Fish
numPatties: 1
links:
ListBurgerDressings:
operationId: listBurgerDressings
parameters:
dressingId: 'something here'
description: 'Try the ketchup!'
"404":
description: Cannot find your burger. Sorry. We may have sold out of this type
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
notFound:
summary: burger missing
value:
message: can't find a burger with that ID, we may have sold out my friend.
"500":
description: Unexpected error. Sorry.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
unexpectedError:
summary: oh my stars
value:
message: something went terribly wrong my friend, burger location crashed!
/burgers/{burgerId}/dressings:
get:
operationId: listBurgerDressings
tags:
- "Dressing"
summary: Get a list of all dressings available
description: Same as the summary, look up a tasty burger, by its ID - the burger identifier
parameters:
- in: path
name: burgerId
schema:
type: string
example: big-mac
description: the name of the our fantastic burger. You can pick a name from our menu
required: true
responses:
"200":
$ref: '#/components/responses/DressingResponse'
"404":
description: Cannot find your burger in which to list dressings. Sorry
content:
application/json:
x-nice: rice
schema:
$ref: '#/components/schemas/Error'
example:
message: There is no burger here
"500":
description: Unexpected error listing dressings for burger. Sorry.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
message: computer says no dressings for this burger.
/dressings/{dressingId}:
x-winter-coat: warm
get:
operationId: getDressing
tags:
- "Dressing"
summary: Get a specific dressing - you can choose the dressing from our menu
description: Same as the summary, get a dressing, by its ID
x-runny-nose: runny.
parameters:
- in: path
name: dressingId
schema:
x-hot-cross-buns: bunny
type: string
example: cheese
description: This is the unique identifier for the dressing items.
required: true
responses:
x-toasty-roasty: hot
"200":
description: a dressing
content:
application/json:
schema:
$ref: '#/components/schemas/Dressing'
example:
name: Butter Sauce
"404":
description: Cannot find your dressing, sorry.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
message: No such dressing as 'Pizza'
"500":
description: Unexpected error getting a dressing. Sorry.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
message: failed looking up dressing by ID, our server borked.
/dressings:
get:
operationId: getAllDressings
tags:
- "Dressing"
summary: Get all dressings available in our store
description: Get all dressings and choose from them
responses:
"200":
description: an array of dressings
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Dressing'
example:
- name: Burger Sauce
"418":
description: I am a teapot.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
message: It's teapot time.
"500":
description: Something went wrong with getting dressings.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
message: "failed looking up all dressings, something went wrong."
components:
callbacks:
BurgerCallback:
x-break-everything: please
"{$request.query.queryUrl}":
post:
requestBody:
description: Callback payload
content:
'application/json':
schema:
$ref: '#/components/schemas/SomePayload'
responses:
'200':
description: callback successfully processes
links:
LocateBurger:
operationId: locateBurger
parameters:
burgerId: '$response.body#/id'
description: Go and get a tasty burger
AnotherLocateBurger:
operationId: locateBurger
parameters:
burgerId: '$response.body#/id'
description: Go and get another really tasty burger
server:
url: https://pb33f.io
headers:
UseOil:
description: this is a header example for UseOil
schema:
type: string
requestBodies:
BurgerRequest:
description: Give us the new burger!
content:
application/json:
schema:
$ref: '#/components/schemas/Burger'
examples:
pbjBurger:
summary: A horrible, nutty, sticky mess.
value:
name: Peanut And Jelly
numPatties: 3
cakeBurger:
summary: A sickly, sweet, atrocity
value:
name: Chocolate Cake Burger
numPatties: 5
examples:
QuarterPounder:
summary: A juicy two hander sammich
value:
name: Quarter Pounder with Cheese
numPatties: 1
responses:
DressingResponse:
description: all the dressings for a burger.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Dressing'
example:
- name: Thousand Island
securitySchemes:
APIKeyScheme:
type: apiKey
description: an apiKey security scheme
name: apiKeyScheme
in: query
JWTScheme:
type: http
description: an JWT security scheme
name: aJWTThing
scheme: bearer
bearerFormat: JWT
OAuthScheme:
type: oauth2
description: an oAuth security scheme
name: oAuthy
flows:
implicit:
authorizationUrl: https://pb33f.io/oauth
scopes:
write:burgers: modify and add new burgers
read:burgers: read all burgers
authorizationCode:
authorizationUrl: https://pb33f.io/oauth
tokenUrl: https://api.pb33f.io/oauth/token
scopes:
write:burgers: modify burgers and stuff
read:burgers: read all the burgers
parameters:
BurgerHeader:
in: header
name: burgerHeader
schema:
properties:
burgerTheme:
type: string
description: something about a theme goes in here?
burgerTime:
type: number
description: number of burgers ordered so far this year.
example: big-mac
description: the name of the burger. use this to order your food
required: true
content:
application/json:
example: somethingNice
encoding:
burgerTheme:
contentType: text/plain
headers:
someHeader:
description: this is a header
schema:
type: string
schema:
type: object
required: [burgerTheme, burgerTime]
properties:
burgerTheme:
type: string
description: something about a theme?
burgerTime:
type: number
description: number of burgers ordered this year.
BurgerId:
in: path
name: burgerId
schema:
type: string
example: big-mac
description: the name of the burger. use this to order your tasty burger
required: true
schemas:
Error:
type: object
description: Error defining what went wrong when providing a specification. The message should help indicate the issue clearly.
properties:
message:
type: string
description: returns the error message if something wrong happens
example: No such burger as 'Big-Whopper'
Burger:
type: object
description: The tastiest food on the planet you would love to eat everyday
required:
- name
- numPatties
properties:
name:
type: string
description: The name of your tasty burger - burger names are listed in our menus
example: Big Mac
numPatties:
type: integer
description: The number of burger patties used
example: 2
numTomatoes:
type: integer
description: how many slices of orange goodness would you like?
example: 1
fries:
$ref: '#/components/schemas/Fries'
Fries:
type: object
description: golden slices of happy fun joy
required:
- potatoShape
- favoriteDrink
properties:
seasoning:
type: array
description: herbs and spices for your golden joy
items:
type: string
description: type of herb or spice used to liven up the yummy
example: salt
potatoShape:
type: string
description: what type of potato shape? wedges? shoestring?
example: Crispy Shoestring
favoriteDrink:
$ref: '#/components/schemas/Drink'
Dressing:
type: object
description: This is the object that contains the information about the content of the dressing
required:
- name
properties:
name:
type: string
description: The name of your dressing you can pick up from the menu
example: Cheese
additionalProperties:
type: object
description: something in here.
Drink:
type: object
description: a frosty cold beverage can be coke or sprite
required:
- size
- drinkType
properties:
ice:
type: boolean
drinkType:
type: string
description: select from coke or sprite
enum:
- coke
size:
type: string
description: what size man? S/M/L
example: M
additionalProperties: true
discriminator:
propertyName: drinkType
mapping:
drink: some value
SomePayload:
type: object
description: some kind of payload for something.
xml:
name: is html programming? yes.
externalDocs:
url: https://pb33f.io/docs
oneOf:
- $ref: '#/components/schemas/Drink'
anyOf:
- $ref: '#/components/schemas/Drink'
allOf:
- $ref: '#/components/schemas/Drink'
not:
type: string
items:
$ref: '#/components/schemas/Drink'
x-screaming-baby: loud
x-something-something: darkside
externalDocs:
description: "Find out more information about our products and services"
url: "https://pb33f.io"
jsonSchemaDialect: https://pb33f.io/schema
webhooks:
someHook:
post:
requestBody:
description: Information about a new burger
content:
application/json:
schema:
$ref: "#/components/schemas/Burger"
responses:
"200":
description: the hook is good! you have a new burger.