forked from OAI/sig-moonwalk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
petstore.yaml
443 lines (442 loc) · 11.6 KB
/
petstore.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
openapi: 4.0.0
info:
title: Swagger Petstore - OpenAPI 4.0
description: |-
This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about
Swagger at [http://swagger.io](http://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!
You can now help us improve the API whether it's by making changes to the definition itself or to the code.
That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
Some useful links:
- [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)
- [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
termsOfService: http://swagger.io/terms/
contact:
email: [email protected]
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.15
paths:
"pet": ## Path is a relative reference. It needs to be anchored to a base by a servers URL. Or if you put an absolute URL in the path, it will be used as is.
requests:
CreatePet: ## Operation name is elevated to be a key for requests but is only unique within the pathItem
method: POST
contentType: application/json
contentSchema:
$ref: "#/components/schemas/Pet"
responses:
Created: ## response names can use conventions to map to request names
status: 201
contentType: application/json
FailPetCreate:
status: 400
contentType: application/http-problem
RetrievePets:
method: GET
responses:
Ok:
status: 200
contentType: application/json
contentSchema:
type: array
items:
$ref: "#/components/schemas/Pet"
OkinCSV:
status: 200
contentType: text/csv
contentSchema:
type: string
FailPetRetrieve:
status: 400
contentType: application/http-problem
"pet/findByStatus?status={status}":
requests:
findPetsByStatus:
description: Multiple status values can be provided with comma separated strings
method: GET
parameterSchema:
type: object
required:
- status
properties:
status:
type: string
enum: [available, pending, sold]
responses:
Ok:
status: 200
contentType: application/json
contentSchema:
type: array
items:
$ref: "#/components/schemas/Pet"
failBadStatus:
status: 400
description: Invalid status value
"pet/findByTags?tags={tags}":
requests:
findPetsByTags:
description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
method: GET
parameterSchema:
type: object
required:
- tags
properties:
tags:
type: string
responses:
Ok:
status: 200
contentType: application/json
contentSchema:
type: array
items:
$ref: "#/components/schemas/Pet"
FailBadTag:
status: 400
description: Invalid tag value
"pet/{petId}": ## Paths support full UriTemplate syntax to enable disambiguation of operations by query parameters. This means we don't need all the style/explode hints in the parameter object.
parameterSchema:
type: object
properties:
petId:
type: string
format: int64
requests:
RetrievePet:
method: GET
responses:
retrieved:
status: 200
description: "The pet was retrieved" ## description is optional
contentType: application/json
contentSchema:
$ref: "#/components/schemas/Pet"
UpdatePet:
method: PUT
contentType: application/json
contentSchema:
$ref: "#/components/schemas/Pet"
responses:
Updated:
status: 200
description: "The pet was updated"
contentType: application/json
contentSchema:
$ref: "#/components/schemas/Pet"
FailPetUpdate:
status: 400
description: "The pet was not updated"
UpdatePetWithForm:
method: POST
contentType: application/x-www-form-urlencoded
contentSchema:
type: object
properties:
name:
type: string
status:
type: string
responses:
Updated:
status: 200
description: "The pet was updated"
contentType: application/json
contentSchema:
$ref: "#/components/schemas/Pet"
FailPetUpdate:
status: 400
description: "The pet was not updated"
DeletePet:
method: DELETE
responses:
deleted:
status: 204
description: "The pet was deleted"
responses:
petNotFound:
status: 404
description: "The pet was not found"
serverError:
status: 5XX
"pet/{petId}/uploadImage{?additionalMetadata}":
parameterSchema:
properties:
petId:
type: string
format: uuid
additionalMetadata:
type: string
requests:
uploadFile:
summary: "Uploads an image"
method: POST
contentType: application/octet-stream
responses:
ok:
status: 200
contentType: application/json
contentSchema:
$ref: "#/components/schemas/ApiResponse"
fail:
status: 400
"/store/order":
requests:
CreateOrder:
method: POST
contentType: application/json
contentSchema:
$ref: "#/components/schemas/Order"
responses:
Created:
status: 201
contentType: application/json
contentSchema:
$ref: "#/components/schemas/Order"
FailOrderCreate:
status: 400
RetrieveOrders:
method: GET
responses:
Ok:
status: 200
contentType: application/json
contentSchema:
type: array
items:
$ref: "#/components/schemas/Order"
FailOrderRetrieve:
status: 400
"/store/order/{orderId}":
parameterSchema:
properties:
orderId:
type: string
format: int64
requests:
RetrieveOrder:
method: GET
responses:
Ok:
status: 200
contentType: application/json
contentSchema:
$ref: "#/components/schemas/Order"
FailOrderRetrieve:
status: 400
DeleteOrder:
method: DELETE
responses:
deleted:
status: 204
description: "The order was deleted"
responses:
orderNotFound:
status: 404
description: "The order was not found"
serverError:
status: 5XX
components:
schemas:
Order:
type: object
properties:
id:
type: integer
format: int64
example: 10
petId:
type: integer
format: int64
example: 198772
quantity:
type: integer
format: int32
example: 7
shipDate:
type: string
format: date-time
status:
type: string
description: Order Status
example: approved
enum:
- placed
- approved
- delivered
complete:
type: boolean
xml:
name: order
Customer:
type: object
properties:
id:
type: integer
format: int64
example: 100000
username:
type: string
example: fehguy
address:
type: array
xml:
name: addresses
wrapped: true
items:
$ref: "#/components/schemas/Address"
xml:
name: customer
Address:
type: object
properties:
street:
type: string
example: 437 Lytton
city:
type: string
example: Palo Alto
state:
type: string
example: CA
zip:
type: string
example: "94301"
xml:
name: address
Category:
type: object
properties:
id:
type: integer
format: int64
example: 1
name:
type: string
example: Dogs
xml:
name: category
User:
type: object
properties:
id:
type: integer
format: int64
example: 10
username:
type: string
example: theUser
firstName:
type: string
example: John
lastName:
type: string
example: James
email:
type: string
example: [email protected]
password:
type: string
example: "12345"
phone:
type: string
example: "12345"
userStatus:
type: integer
description: User Status
format: int32
example: 1
xml:
name: user
Tag:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
xml:
name: tag
Pet:
required:
- name
- photoUrls
type: object
properties:
id:
type: integer
format: int64
example: 10
name:
type: string
example: doggie
category:
$ref: "#/components/schemas/Category"
photoUrls:
type: array
xml:
wrapped: true
items:
type: string
xml:
name: photoUrl
tags:
type: array
xml:
wrapped: true
items:
$ref: "#/components/schemas/Tag"
status:
type: string
description: pet status in the store
enum:
- available
- pending
- sold
xml:
name: pet
ApiResponse:
type: object
properties:
code:
type: integer
format: int32
type:
type: string
message:
type: string
xml:
name: "##default"
requestBodies:
Pet:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: "#/components/schemas/Pet"
application/xml:
schema:
$ref: "#/components/schemas/Pet"
UserArray:
description: List of user object
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/User"
securitySchemes:
petstore_auth:
type: oauth2
flows:
implicit:
authorizationUrl: https://petstore3.swagger.io/oauth/authorize
scopes:
write:pets: modify pets in your account
read:pets: read your pets
api_key:
type: apiKey
name: api_key
in: header