· 5 years ago · Aug 17, 2020, 01:52 AM
1---
2openapi: 3.0.0
3servers:
4- url: http://petstore.swagger.io/v2
5info:
6 description: ":dog: :cat: :rabbit: This is a sample server Petstore server. You
7 can find out more about Swagger at [http://swagger.io](http://swagger.io) or on
8 [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can
9 use the api key `special-key` to test the authorization filters."
10 version: 1.0.0
11 title: Swagger Petstore
12 termsOfService: http://swagger.io/terms/
13 contact:
14 email: apiteam@swagger.io
15 license:
16 name: Apache 2.0
17 url: http://www.apache.org/licenses/LICENSE-2.0.html
18tags:
19- name: pet
20 description: Everything about your Pets
21 externalDocs:
22 description: Find out more
23 url: http://swagger.io
24- name: store
25 description: Access to Petstore orders
26- name: user
27 description: Operations about user
28 externalDocs:
29 description: Find out more about our store
30 url: http://swagger.io
31paths:
32 "/pet":
33 post:
34 tags:
35 - pet
36 summary: Add a new pet to the store
37 description: ''
38 operationId: addPet
39 responses:
40 '405':
41 description: Invalid input
42 security:
43 - petstore_auth:
44 - write:pets
45 - read:pets
46 requestBody:
47 "$ref": "#/components/requestBodies/Pet"
48 parameters: []
49 put:
50 tags:
51 - pet
52 summary: Update an existing pet
53 description: ''
54 operationId: updatePet
55 responses:
56 '400':
57 description: Invalid ID supplied
58 '404':
59 description: Pet not found
60 '405':
61 description: Validation exception
62 security:
63 - petstore_auth:
64 - write:pets
65 - read:pets
66 requestBody:
67 "$ref": "#/components/requestBodies/Pet"
68 parameters: []
69 "/pet/findByStatus":
70 get:
71 tags:
72 - pet
73 summary: Finds Pets by status
74 description: Multiple status values can be provided with comma separated strings
75 operationId: findPetsByStatus
76 parameters:
77 - name: status
78 in: query
79 description: Status values that need to be considered for filter
80 required: true
81 explode: true
82 schema:
83 type: array
84 items:
85 type: string
86 enum:
87 - available
88 - pending
89 - sold
90 default: available
91 responses:
92 '200':
93 description: successful operation
94 content:
95 application/xml:
96 schema:
97 type: array
98 items:
99 "$ref": "#/components/schemas/Pet"
100 application/json:
101 schema:
102 type: array
103 items:
104 "$ref": "#/components/schemas/Pet"
105 '400':
106 description: Invalid status value
107 security:
108 - petstore_auth:
109 - write:pets
110 - read:pets
111 "/pet/findByTags":
112 get:
113 tags:
114 - pet
115 summary: Finds Pets by tags
116 description: Muliple tags can be provided with comma separated strings. Use
117 tag1, tag2, tag3 for testing.
118 operationId: findPetsByTags
119 parameters:
120 - name: tags
121 in: query
122 description: Tags to filter by
123 required: true
124 explode: true
125 schema:
126 type: array
127 items:
128 type: string
129 responses:
130 '200':
131 description: successful operation
132 content:
133 application/xml:
134 schema:
135 type: array
136 items:
137 "$ref": "#/components/schemas/Pet"
138 application/json:
139 schema:
140 type: array
141 items:
142 "$ref": "#/components/schemas/Pet"
143 '400':
144 description: Invalid tag value
145 security:
146 - petstore_auth:
147 - write:pets
148 - read:pets
149 deprecated: true
150 "/pet/{petId}":
151 get:
152 tags:
153 - pet
154 summary: Find pet by ID
155 description: Returns a single pet
156 operationId: getPetById
157 parameters:
158 - name: petId
159 in: path
160 description: ID of pet to return
161 required: true
162 schema:
163 type: integer
164 format: int64
165 responses:
166 '200':
167 description: successful operation
168 content:
169 application/xml:
170 schema:
171 "$ref": "#/components/schemas/Pet"
172 application/json:
173 schema:
174 "$ref": "#/components/schemas/Pet"
175 '400':
176 description: Invalid ID supplied
177 '404':
178 description: Pet not found
179 security:
180 - api_key: []
181 post:
182 tags:
183 - pet
184 summary: Updates a pet in the store with form data
185 description: ''
186 operationId: updatePetWithForm
187 parameters:
188 - name: petId
189 in: path
190 description: ID of pet that needs to be updated
191 required: true
192 schema:
193 type: integer
194 format: int64
195 responses:
196 '405':
197 description: Invalid input
198 security:
199 - petstore_auth:
200 - write:pets
201 - read:pets
202 requestBody:
203 content:
204 application/x-www-form-urlencoded:
205 schema:
206 type: object
207 properties:
208 name:
209 description: Updated name of the pet
210 type: string
211 status:
212 description: Updated status of the pet
213 type: string
214 delete:
215 tags:
216 - pet
217 summary: Deletes a pet
218 description: ''
219 operationId: deletePet
220 parameters:
221 - name: api_key
222 in: header
223 required: false
224 schema:
225 type: string
226 - name: petId
227 in: path
228 description: Pet id to delete
229 required: true
230 schema:
231 type: integer
232 format: int64
233 responses:
234 '400':
235 description: Invalid ID supplied
236 '404':
237 description: Pet not found
238 security:
239 - petstore_auth:
240 - write:pets
241 - read:pets
242 "/pet/{petId}/uploadImage":
243 post:
244 tags:
245 - pet
246 summary: uploads an image
247 description: ''
248 operationId: uploadFile
249 parameters:
250 - name: petId
251 in: path
252 description: ID of pet to update
253 required: true
254 schema:
255 type: integer
256 format: int64
257 responses:
258 '200':
259 description: successful operation
260 content:
261 application/json:
262 schema:
263 "$ref": "#/components/schemas/ApiResponse"
264 security:
265 - petstore_auth:
266 - write:pets
267 - read:pets
268 requestBody:
269 content:
270 application/octet-stream:
271 schema:
272 type: string
273 format: binary
274 "/store/inventory":
275 get:
276 tags:
277 - store
278 summary: Returns pet inventories by status
279 description: Returns a map of status codes to quantities
280 operationId: getInventory
281 responses:
282 '200':
283 description: successful operation
284 content:
285 application/json:
286 schema:
287 type: object
288 additionalProperties:
289 type: integer
290 format: int32
291 security:
292 - api_key: []
293 parameters: []
294 "/store/order":
295 post:
296 tags:
297 - store
298 summary: Place an order for a pet
299 description: ''
300 operationId: placeOrder
301 responses:
302 '200':
303 description: successful operation
304 content:
305 application/xml:
306 schema:
307 "$ref": "#/components/schemas/Order"
308 application/json:
309 schema:
310 "$ref": "#/components/schemas/Order"
311 '400':
312 description: Invalid Order
313 requestBody:
314 content:
315 application/json:
316 schema:
317 "$ref": "#/components/schemas/Order"
318 description: order placed for purchasing the pet
319 required: true
320 parameters: []
321 "/store/order/{orderId}":
322 get:
323 tags:
324 - store
325 summary: Find purchase order by ID
326 description: For valid response try integer IDs with value >= 1 and <= 10. Other
327 values will generated exceptions
328 operationId: getOrderById
329 parameters:
330 - name: orderId
331 in: path
332 description: ID of pet that needs to be fetched
333 required: true
334 schema:
335 type: integer
336 format: int64
337 minimum: 1
338 maximum: 10
339 responses:
340 '200':
341 description: successful operation
342 content:
343 application/xml:
344 schema:
345 "$ref": "#/components/schemas/Order"
346 application/json:
347 schema:
348 "$ref": "#/components/schemas/Order"
349 '400':
350 description: Invalid ID supplied
351 '404':
352 description: Order not found
353 delete:
354 tags:
355 - store
356 summary: Delete purchase order by ID
357 description: For valid response try integer IDs with positive integer value.
358 Negative or non-integer values will generate API errors
359 operationId: deleteOrder
360 parameters:
361 - name: orderId
362 in: path
363 description: ID of the order that needs to be deleted
364 required: true
365 schema:
366 type: integer
367 format: int64
368 minimum: 1
369 responses:
370 '400':
371 description: Invalid ID supplied
372 '404':
373 description: Order not found
374 "/user":
375 post:
376 tags:
377 - user
378 summary: Create user
379 description: This can only be done by the logged in user.
380 operationId: createUser
381 responses:
382 default:
383 description: successful operation
384 requestBody:
385 content:
386 application/json:
387 schema:
388 "$ref": "#/components/schemas/User"
389 description: Created user object
390 required: true
391 parameters: []
392 "/user/createWithArray":
393 post:
394 tags:
395 - user
396 summary: Creates list of users with given input array
397 description: ''
398 operationId: createUsersWithArrayInput
399 responses:
400 default:
401 description: successful operation
402 requestBody:
403 "$ref": "#/components/requestBodies/UserArray"
404 parameters: []
405 "/user/createWithList":
406 post:
407 tags:
408 - user
409 summary: Creates list of users with given input array
410 description: ''
411 operationId: createUsersWithListInput
412 responses:
413 default:
414 description: successful operation
415 requestBody:
416 "$ref": "#/components/requestBodies/UserArray"
417 parameters: []
418 "/user/login":
419 get:
420 tags:
421 - user
422 summary: Logs user into the system
423 description: ''
424 operationId: loginUser
425 parameters:
426 - name: username
427 in: query
428 description: The user name for login
429 required: true
430 schema:
431 type: string
432 - name: password
433 in: query
434 description: The password for login in clear text
435 required: true
436 schema:
437 type: string
438 format: password
439 responses:
440 '200':
441 description: successful operation
442 headers:
443 X-Rate-Limit:
444 description: calls per hour allowed by the user
445 schema:
446 type: integer
447 format: int32
448 X-Expires-After:
449 description: date in UTC when token expires
450 schema:
451 type: string
452 format: date-time
453 content:
454 application/xml:
455 schema:
456 type: string
457 application/json:
458 schema:
459 type: string
460 '400':
461 description: Invalid username/password supplied
462 "/user/logout":
463 get:
464 tags:
465 - user
466 summary: Logs out current logged in user session
467 description: ''
468 operationId: logoutUser
469 responses:
470 default:
471 description: successful operation
472 parameters: []
473 "/user/{username}":
474 get:
475 tags:
476 - user
477 summary: Get user by user name
478 description: ''
479 operationId: getUserByName
480 parameters:
481 - name: username
482 in: path
483 description: 'The name that needs to be fetched. Use user1 for testing. '
484 required: true
485 schema:
486 type: string
487 responses:
488 '200':
489 description: successful operation
490 content:
491 application/xml:
492 schema:
493 "$ref": "#/components/schemas/User"
494 application/json:
495 schema:
496 "$ref": "#/components/schemas/User"
497 '400':
498 description: Invalid username supplied
499 '404':
500 description: User not found
501 put:
502 tags:
503 - user
504 summary: Updated user
505 description: This can only be done by the logged in user.
506 operationId: updateUser
507 parameters:
508 - name: username
509 in: path
510 description: name that need to be updated
511 required: true
512 schema:
513 type: string
514 responses:
515 '400':
516 description: Invalid user supplied
517 '404':
518 description: User not found
519 requestBody:
520 content:
521 application/json:
522 schema:
523 "$ref": "#/components/schemas/User"
524 description: Updated user object
525 required: true
526 delete:
527 tags:
528 - user
529 summary: Delete user
530 description: This can only be done by the logged in user.
531 operationId: deleteUser
532 parameters:
533 - name: username
534 in: path
535 description: The name that needs to be deleted
536 required: true
537 schema:
538 type: string
539 responses:
540 '400':
541 description: Invalid username supplied
542 '404':
543 description: User not found
544externalDocs:
545 description: See AsyncAPI example
546 url: https://mermade.github.io/shins/asyncapi.html
547components:
548 schemas:
549 Order:
550 type: object
551 properties:
552 id:
553 type: integer
554 format: int64
555 petId:
556 type: integer
557 format: int64
558 quantity:
559 type: integer
560 format: int32
561 shipDate:
562 type: string
563 format: date-time
564 status:
565 type: string
566 description: Order Status
567 enum:
568 - placed
569 - approved
570 - delivered
571 complete:
572 type: boolean
573 default: false
574 xml:
575 name: Order
576 Category:
577 type: object
578 properties:
579 id:
580 type: integer
581 format: int64
582 name:
583 type: string
584 xml:
585 name: Category
586 User:
587 type: object
588 properties:
589 id:
590 type: integer
591 format: int64
592 username:
593 type: string
594 firstName:
595 type: string
596 lastName:
597 type: string
598 email:
599 type: string
600 password:
601 type: string
602 phone:
603 type: string
604 userStatus:
605 type: integer
606 format: int32
607 description: User Status
608 xml:
609 name: User
610 Tag:
611 type: object
612 properties:
613 id:
614 type: integer
615 format: int64
616 name:
617 type: string
618 xml:
619 name: Tag
620 Pet:
621 type: object
622 required:
623 - name
624 - photoUrls
625 properties:
626 id:
627 type: integer
628 format: int64
629 category:
630 "$ref": "#/components/schemas/Category"
631 name:
632 type: string
633 example: doggie
634 photoUrls:
635 type: array
636 xml:
637 name: photoUrl
638 wrapped: true
639 items:
640 type: string
641 tags:
642 type: array
643 xml:
644 name: tag
645 wrapped: true
646 items:
647 "$ref": "#/components/schemas/Tag"
648 status:
649 type: string
650 description: pet status in the store
651 enum:
652 - available
653 - pending
654 - sold
655 xml:
656 name: Pet
657 ApiResponse:
658 type: object
659 properties:
660 code:
661 type: integer
662 format: int32
663 type:
664 type: string
665 message:
666 type: string
667 requestBodies:
668 Pet:
669 content:
670 application/json:
671 schema:
672 "$ref": "#/components/schemas/Pet"
673 application/xml:
674 schema:
675 "$ref": "#/components/schemas/Pet"
676 description: Pet object that needs to be added to the store
677 required: true
678 UserArray:
679 content:
680 application/json:
681 schema:
682 type: array
683 items:
684 "$ref": "#/components/schemas/User"
685 description: List of user object
686 required: true
687 securitySchemes:
688 petstore_auth:
689 type: oauth2
690 flows:
691 implicit:
692 authorizationUrl: http://petstore.swagger.io/oauth/dialog
693 scopes:
694 write:pets: modify pets in your account
695 read:pets: read your pets
696 api_key:
697 type: apiKey
698 name: api_key
699 in: header
700 links: {}
701 callbacks: {}
702security: []
703