petstore-only-pet.openapi.yaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. openapi: 3.0.2
  2. servers:
  3. - url: /v3
  4. info:
  5. description: |-
  6. This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about
  7. Swagger at [http://swagger.io](http://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!
  8. You can now help us improve the API whether it's by making changes to the definition itself or to the code.
  9. That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
  10. Some useful links:
  11. - [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)
  12. - [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
  13. version: 1.0.5-SNAPSHOT
  14. title: Swagger Petstore - OpenAPI 3.0
  15. termsOfService: 'http://swagger.io/terms/'
  16. contact:
  17. email: apiteam@swagger.io
  18. license:
  19. name: Apache 2.0
  20. url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
  21. tags:
  22. - name: pet
  23. description: Everything about your Pets
  24. externalDocs:
  25. description: Find out more
  26. url: 'http://swagger.io'
  27. paths:
  28. /pet:
  29. post:
  30. tags:
  31. - pet
  32. summary: Add a new pet to the store
  33. description: Add a new pet to the store
  34. operationId: addPet
  35. responses:
  36. '200':
  37. description: Successful operation
  38. content:
  39. application/xml:
  40. schema:
  41. $ref: '#/components/schemas/Pet'
  42. application/json:
  43. schema:
  44. $ref: '#/components/schemas/Pet'
  45. '405':
  46. description: Invalid input
  47. security:
  48. - petstore_auth:
  49. - 'write:pets'
  50. - 'read:pets'
  51. requestBody:
  52. description: Create a new pet in the store
  53. required: true
  54. content:
  55. application/json:
  56. schema:
  57. $ref: '#/components/schemas/Pet'
  58. application/xml:
  59. schema:
  60. $ref: '#/components/schemas/Pet'
  61. application/x-www-form-urlencoded:
  62. schema:
  63. $ref: '#/components/schemas/Pet'
  64. put:
  65. tags:
  66. - pet
  67. summary: Update an existing pet
  68. description: Update an existing pet by Id
  69. operationId: updatePet
  70. responses:
  71. '200':
  72. description: Successful operation
  73. content:
  74. application/xml:
  75. schema:
  76. $ref: '#/components/schemas/Pet'
  77. application/json:
  78. schema:
  79. $ref: '#/components/schemas/Pet'
  80. '400':
  81. description: Invalid ID supplied
  82. '404':
  83. description: Pet not found
  84. '405':
  85. description: Validation exception
  86. security:
  87. - petstore_auth:
  88. - 'write:pets'
  89. - 'read:pets'
  90. requestBody:
  91. description: Update an existent pet in the store
  92. required: true
  93. content:
  94. application/json:
  95. schema:
  96. $ref: '#/components/schemas/Pet'
  97. application/xml:
  98. schema:
  99. $ref: '#/components/schemas/Pet'
  100. application/x-www-form-urlencoded:
  101. schema:
  102. $ref: '#/components/schemas/Pet'
  103. /pet/findByStatus:
  104. get:
  105. tags:
  106. - pet
  107. summary: Finds Pets by status
  108. description: Multiple status values can be provided with comma separated strings
  109. operationId: findPetsByStatus
  110. parameters:
  111. - name: status
  112. in: query
  113. description: Status values that need to be considered for filter
  114. required: false
  115. explode: true
  116. schema:
  117. type: string
  118. enum:
  119. - available
  120. - pending
  121. - sold
  122. default: available
  123. responses:
  124. '200':
  125. description: successful operation
  126. content:
  127. application/xml:
  128. schema:
  129. type: array
  130. items:
  131. $ref: '#/components/schemas/Pet'
  132. application/json:
  133. schema:
  134. type: array
  135. items:
  136. $ref: '#/components/schemas/Pet'
  137. '400':
  138. description: Invalid status value
  139. security:
  140. - petstore_auth:
  141. - 'write:pets'
  142. - 'read:pets'
  143. /pet/findByTags:
  144. get:
  145. tags:
  146. - pet
  147. summary: Finds Pets by tags
  148. description: >-
  149. Multiple tags can be provided with comma separated strings. Use tag1,
  150. tag2, tag3 for testing.
  151. operationId: findPetsByTags
  152. parameters:
  153. - name: tags
  154. in: query
  155. description: Tags to filter by
  156. required: false
  157. explode: true
  158. schema:
  159. type: array
  160. items:
  161. type: string
  162. responses:
  163. '200':
  164. description: successful operation
  165. content:
  166. application/xml:
  167. schema:
  168. type: array
  169. items:
  170. $ref: '#/components/schemas/Pet'
  171. application/json:
  172. schema:
  173. type: array
  174. items:
  175. $ref: '#/components/schemas/Pet'
  176. '400':
  177. description: Invalid tag value
  178. security:
  179. - petstore_auth:
  180. - 'write:pets'
  181. - 'read:pets'
  182. '/pet/{petId}':
  183. get:
  184. tags:
  185. - pet
  186. summary: Find pet by ID
  187. description: Returns a single pet
  188. operationId: getPetById
  189. parameters:
  190. - name: petId
  191. in: path
  192. description: ID of pet to return
  193. required: true
  194. schema:
  195. type: integer
  196. format: int64
  197. responses:
  198. '200':
  199. description: successful operation
  200. content:
  201. application/xml:
  202. schema:
  203. $ref: '#/components/schemas/Pet'
  204. application/json:
  205. schema:
  206. $ref: '#/components/schemas/Pet'
  207. '400':
  208. description: Invalid ID supplied
  209. '404':
  210. description: Pet not found
  211. security:
  212. - api_key: []
  213. - petstore_auth:
  214. - 'write:pets'
  215. - 'read:pets'
  216. post:
  217. tags:
  218. - pet
  219. summary: Updates a pet in the store with form data
  220. description: ''
  221. operationId: updatePetWithForm
  222. parameters:
  223. - name: petId
  224. in: path
  225. description: ID of pet that needs to be updated
  226. required: true
  227. schema:
  228. type: integer
  229. format: int64
  230. - name: name
  231. in: query
  232. description: Name of pet that needs to be updated
  233. required: true
  234. schema:
  235. type: string
  236. - name: status
  237. in: query
  238. description: Status of pet that needs to be updated
  239. schema:
  240. type: string
  241. responses:
  242. '405':
  243. description: Invalid input
  244. security:
  245. - petstore_auth:
  246. - 'write:pets'
  247. - 'read:pets'
  248. delete:
  249. tags:
  250. - pet
  251. summary: Deletes a pet
  252. description: ''
  253. operationId: deletePet
  254. parameters:
  255. - name: api_key
  256. in: header
  257. description: ''
  258. required: false
  259. schema:
  260. type: string
  261. - name: petId
  262. in: path
  263. description: Pet id to delete
  264. required: true
  265. schema:
  266. type: integer
  267. format: int64
  268. responses:
  269. '400':
  270. description: Invalid pet value
  271. security:
  272. - petstore_auth:
  273. - 'write:pets'
  274. - 'read:pets'
  275. '/pet/{petId}/uploadImage':
  276. post:
  277. tags:
  278. - pet
  279. summary: uploads an image
  280. description: ''
  281. operationId: uploadFile
  282. parameters:
  283. - name: petId
  284. in: path
  285. description: ID of pet to update
  286. required: true
  287. schema:
  288. type: integer
  289. format: int64
  290. - name: additionalMetadata
  291. in: query
  292. description: Additional Metadata
  293. required: false
  294. schema:
  295. type: string
  296. responses:
  297. '200':
  298. description: successful operation
  299. content:
  300. application/json:
  301. schema:
  302. $ref: '#/components/schemas/ApiResponse'
  303. security:
  304. - petstore_auth:
  305. - 'write:pets'
  306. - 'read:pets'
  307. requestBody:
  308. content:
  309. application/octet-stream:
  310. schema:
  311. type: string
  312. format: binary
  313. externalDocs:
  314. description: Find out more about Swagger
  315. url: 'http://swagger.io'
  316. components:
  317. schemas:
  318. Category:
  319. x-swagger-router-model: io.swagger.petstore.model.Category
  320. properties:
  321. id:
  322. type: integer
  323. format: int64
  324. example: 1
  325. name:
  326. type: string
  327. example: Dogs
  328. xml:
  329. name: category
  330. type: object
  331. Tag:
  332. x-swagger-router-model: io.swagger.petstore.model.Tag
  333. properties:
  334. id:
  335. type: integer
  336. format: int64
  337. name:
  338. type: string
  339. xml:
  340. name: tag
  341. type: object
  342. Pet:
  343. x-swagger-router-model: io.swagger.petstore.model.Pet
  344. required:
  345. - name
  346. - photoUrls
  347. properties:
  348. id:
  349. type: integer
  350. format: int64
  351. example: 10
  352. name:
  353. type: string
  354. example: doggie
  355. category:
  356. $ref: '#/components/schemas/Category'
  357. photoUrls:
  358. type: array
  359. xml:
  360. wrapped: true
  361. items:
  362. type: string
  363. xml:
  364. name: photoUrl
  365. tags:
  366. type: array
  367. xml:
  368. wrapped: true
  369. items:
  370. $ref: '#/components/schemas/Tag'
  371. xml:
  372. name: tag
  373. status:
  374. type: string
  375. description: pet status in the store
  376. enum:
  377. - available
  378. - pending
  379. - sold
  380. xml:
  381. name: pet
  382. type: object
  383. ApiResponse:
  384. properties:
  385. code:
  386. type: integer
  387. format: int32
  388. type:
  389. type: string
  390. message:
  391. type: string
  392. xml:
  393. name: '##default'
  394. type: object
  395. requestBodies:
  396. Pet:
  397. content:
  398. application/json:
  399. schema:
  400. $ref: '#/components/schemas/Pet'
  401. application/xml:
  402. schema:
  403. $ref: '#/components/schemas/Pet'
  404. description: Pet object that needs to be added to the store
  405. securitySchemes:
  406. petstore_auth:
  407. type: oauth2
  408. flows:
  409. implicit:
  410. authorizationUrl: 'https://petstore.swagger.io/oauth/authorize'
  411. scopes:
  412. 'write:pets': modify pets in your account
  413. 'read:pets': read your pets
  414. api_key:
  415. type: apiKey
  416. name: api_key
  417. in: header