petstore-simple.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. {
  2. "openapi": "3.0.0",
  3. "info": {
  4. "title": "Swagger Petstore",
  5. "description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
  6. "termsOfService": "http://swagger.io/terms/",
  7. "contact": {
  8. "name": "Swagger API Team"
  9. },
  10. "license": {
  11. "name": "MIT"
  12. },
  13. "version": "1.0.0"
  14. },
  15. "servers": [
  16. {
  17. "url": "petstore.swagger.io",
  18. "description": "API server"
  19. }
  20. ],
  21. "paths": {
  22. "/pets": {
  23. "get": {
  24. "description": "Returns all pets from the system that the user has access to",
  25. "operationId": "findPets",
  26. "parameters": [
  27. {
  28. "name": "tags",
  29. "in": "query",
  30. "description": "tags to filter by",
  31. "required": false,
  32. "style": "form",
  33. "schema": {
  34. "type": "array",
  35. "items": {
  36. "type": "string"
  37. }
  38. }
  39. },
  40. {
  41. "name": "limit",
  42. "in": "query",
  43. "description": "maximum number of results to return",
  44. "required": false,
  45. "schema": {
  46. "type": "integer",
  47. "format": "int32"
  48. }
  49. }
  50. ],
  51. "responses": {
  52. "200": {
  53. "description": "pet response",
  54. "content": {
  55. "application/xml": {
  56. "schema": {
  57. "type": "array",
  58. "items": {
  59. "$ref": "#/components/schemas/Pet"
  60. }
  61. }
  62. },
  63. "text/xml": {
  64. "schema": {
  65. "type": "array",
  66. "items": {
  67. "$ref": "#/components/schemas/Pet"
  68. }
  69. }
  70. },
  71. "text/html": {
  72. "schema": {
  73. "type": "array",
  74. "items": {
  75. "$ref": "#/components/schemas/Pet"
  76. }
  77. }
  78. },
  79. "application/json": {
  80. "schema": {
  81. "type": "array",
  82. "items": {
  83. "$ref": "#/components/schemas/Pet"
  84. }
  85. }
  86. }
  87. }
  88. },
  89. "default": {
  90. "description": "unexpected error",
  91. "content": {
  92. "application/xml": {
  93. "schema": {
  94. "$ref": "#/components/schemas/ErrorModel"
  95. }
  96. },
  97. "text/xml": {
  98. "schema": {
  99. "$ref": "#/components/schemas/ErrorModel"
  100. }
  101. },
  102. "text/html": {
  103. "schema": {
  104. "$ref": "#/components/schemas/ErrorModel"
  105. }
  106. },
  107. "application/json": {
  108. "schema": {
  109. "$ref": "#/components/schemas/ErrorModel"
  110. }
  111. }
  112. }
  113. }
  114. }
  115. },
  116. "post": {
  117. "description": "Creates a new pet in the store. Duplicates are allowed",
  118. "operationId": "addPet",
  119. "requestBody": {
  120. "description": "Pet to add to the store",
  121. "required": true,
  122. "content": {
  123. "multipart/form-data": {
  124. "schema": {
  125. "$ref": "#/components/schemas/NewPet"
  126. }
  127. }
  128. }
  129. },
  130. "responses": {
  131. "200": {
  132. "description": "pet response",
  133. "content": {
  134. "application/json": {
  135. "schema": {
  136. "$ref": "#/components/schemas/Pet"
  137. }
  138. }
  139. }
  140. },
  141. "default": {
  142. "description": "unexpected error",
  143. "content": {
  144. "application/json": {
  145. "schema": {
  146. "$ref": "#/components/schemas/ErrorModel"
  147. }
  148. }
  149. }
  150. }
  151. }
  152. }
  153. },
  154. "/pets/{id}": {
  155. "get": {
  156. "description": "Returns a user based on a single ID, if the user does not have access to the pet",
  157. "operationId": "findPetById",
  158. "parameters": [
  159. {
  160. "name": "id",
  161. "in": "path",
  162. "description": "ID of pet to fetch",
  163. "required": true,
  164. "schema": {
  165. "type": "integer",
  166. "format": "int64"
  167. }
  168. }
  169. ],
  170. "responses": {
  171. "200": {
  172. "description": "pet response",
  173. "content": {
  174. "application/xml": {
  175. "schema": {
  176. "$ref": "#/components/schemas/Pet"
  177. }
  178. },
  179. "text/xml": {
  180. "schema": {
  181. "$ref": "#/components/schemas/Pet"
  182. }
  183. },
  184. "text/html": {
  185. "schema": {
  186. "$ref": "#/components/schemas/Pet"
  187. }
  188. },
  189. "application/json": {
  190. "schema": {
  191. "$ref": "#/components/schemas/Pet"
  192. }
  193. }
  194. }
  195. },
  196. "default": {
  197. "description": "unexpected error",
  198. "content": {
  199. "application/xml": {
  200. "schema": {
  201. "$ref": "#/components/schemas/ErrorModel"
  202. }
  203. },
  204. "text/xml": {
  205. "schema": {
  206. "$ref": "#/components/schemas/ErrorModel"
  207. }
  208. },
  209. "text/html": {
  210. "schema": {
  211. "$ref": "#/components/schemas/ErrorModel"
  212. }
  213. },
  214. "application/json": {
  215. "schema": {
  216. "$ref": "#/components/schemas/ErrorModel"
  217. }
  218. }
  219. }
  220. }
  221. }
  222. },
  223. "delete": {
  224. "description": "deletes a single pet based on the ID supplied",
  225. "operationId": "deletePet",
  226. "parameters": [
  227. {
  228. "name": "id",
  229. "in": "path",
  230. "description": "ID of pet to delete",
  231. "required": true,
  232. "schema": {
  233. "type": "integer",
  234. "format": "int64"
  235. }
  236. }
  237. ],
  238. "responses": {
  239. "204": {
  240. "description": "pet deleted"
  241. },
  242. "default": {
  243. "description": "unexpected error"
  244. }
  245. }
  246. }
  247. }
  248. },
  249. "components": {
  250. "schemas": {
  251. "NewPet": {
  252. "required": [
  253. "name"
  254. ],
  255. "properties": {
  256. "name": {
  257. "type": "string"
  258. },
  259. "tag": {
  260. "type": "string"
  261. }
  262. },
  263. "type": "object"
  264. },
  265. "Pet": {
  266. "type": "object",
  267. "allOf": [
  268. {
  269. "$ref": "#/components/schemas/NewPet"
  270. },
  271. {
  272. "required": [
  273. "id"
  274. ],
  275. "properties": {
  276. "id": {
  277. "type": "integer",
  278. "format": "int64"
  279. }
  280. },
  281. "type": "object"
  282. }
  283. ]
  284. },
  285. "ErrorModel": {
  286. "required": [
  287. "code",
  288. "message"
  289. ],
  290. "properties": {
  291. "code": {
  292. "type": "integer",
  293. "format": "int32"
  294. },
  295. "message": {
  296. "type": "string"
  297. }
  298. },
  299. "type": "object"
  300. }
  301. }
  302. }
  303. }