petstore-with-external-docs.json 11 KB

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