petstore-with-external-docs.json 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. {
  2. "swagger": "2.0",
  3. "info": {
  4. "version": "1.0.0",
  5. "title": "Swagger Petstore",
  6. "description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
  7. "termsOfService": "http://swagger.io/terms/",
  8. "contact": {
  9. "name": "Swagger API Team",
  10. "email": "apiteam@swagger.io",
  11. "url": "http://swagger.io"
  12. },
  13. "license": {
  14. "name": "MIT",
  15. "url": "http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT"
  16. }
  17. },
  18. "externalDocs": {
  19. "description": "find more info here",
  20. "url": "https://swagger.io/about"
  21. },
  22. "host": "petstore.swagger.io",
  23. "basePath": "/api",
  24. "schemes": [
  25. "http"
  26. ],
  27. "consumes": [
  28. "application/json"
  29. ],
  30. "produces": [
  31. "application/json"
  32. ],
  33. "paths": {
  34. "/pets": {
  35. "get": {
  36. "description": "Returns all pets from the system that the user has access to",
  37. "operationId": "findPets",
  38. "externalDocs": {
  39. "description": "find more info here",
  40. "url": "https://swagger.io/about"
  41. },
  42. "produces": [
  43. "application/json",
  44. "application/xml",
  45. "text/xml",
  46. "text/html"
  47. ],
  48. "parameters": [
  49. {
  50. "name": "tags",
  51. "in": "query",
  52. "description": "tags to filter by",
  53. "required": false,
  54. "type": "array",
  55. "items": {
  56. "type": "string"
  57. },
  58. "collectionFormat": "csv"
  59. },
  60. {
  61. "name": "limit",
  62. "in": "query",
  63. "description": "maximum number of results to return",
  64. "required": false,
  65. "type": "integer",
  66. "format": "int32"
  67. }
  68. ],
  69. "responses": {
  70. "200": {
  71. "description": "pet response",
  72. "schema": {
  73. "type": "array",
  74. "items": {
  75. "$ref": "#/definitions/Pet"
  76. }
  77. }
  78. },
  79. "default": {
  80. "description": "unexpected error",
  81. "schema": {
  82. "$ref": "#/definitions/ErrorModel"
  83. }
  84. }
  85. }
  86. },
  87. "post": {
  88. "description": "Creates a new pet in the store. Duplicates are allowed",
  89. "operationId": "addPet",
  90. "produces": [
  91. "application/json"
  92. ],
  93. "parameters": [
  94. {
  95. "name": "pet",
  96. "in": "body",
  97. "description": "Pet to add to the store",
  98. "required": true,
  99. "schema": {
  100. "$ref": "#/definitions/NewPet"
  101. }
  102. }
  103. ],
  104. "responses": {
  105. "200": {
  106. "description": "pet response",
  107. "schema": {
  108. "$ref": "#/definitions/Pet"
  109. }
  110. },
  111. "default": {
  112. "description": "unexpected error",
  113. "schema": {
  114. "$ref": "#/definitions/ErrorModel"
  115. }
  116. }
  117. }
  118. }
  119. },
  120. "/pets/{id}": {
  121. "get": {
  122. "description": "Returns a user based on a single ID, if the user does not have access to the pet",
  123. "operationId": "findPetById",
  124. "produces": [
  125. "application/json",
  126. "application/xml",
  127. "text/xml",
  128. "text/html"
  129. ],
  130. "parameters": [
  131. {
  132. "name": "id",
  133. "in": "path",
  134. "description": "ID of pet to fetch",
  135. "required": true,
  136. "type": "integer",
  137. "format": "int64"
  138. }
  139. ],
  140. "responses": {
  141. "200": {
  142. "description": "pet response",
  143. "schema": {
  144. "$ref": "#/definitions/Pet"
  145. }
  146. },
  147. "default": {
  148. "description": "unexpected error",
  149. "schema": {
  150. "$ref": "#/definitions/ErrorModel"
  151. }
  152. }
  153. }
  154. },
  155. "delete": {
  156. "description": "deletes a single pet based on the ID supplied",
  157. "operationId": "deletePet",
  158. "parameters": [
  159. {
  160. "name": "id",
  161. "in": "path",
  162. "description": "ID of pet to delete",
  163. "required": true,
  164. "type": "integer",
  165. "format": "int64"
  166. }
  167. ],
  168. "responses": {
  169. "204": {
  170. "description": "pet deleted"
  171. },
  172. "default": {
  173. "description": "unexpected error",
  174. "schema": {
  175. "$ref": "#/definitions/ErrorModel"
  176. }
  177. }
  178. }
  179. }
  180. }
  181. },
  182. "definitions": {
  183. "Pet": {
  184. "type": "object",
  185. "allOf": [
  186. {
  187. "$ref": "#/definitions/NewPet"
  188. },
  189. {
  190. "required": [
  191. "id"
  192. ],
  193. "properties": {
  194. "id": {
  195. "type": "integer",
  196. "format": "int64"
  197. }
  198. }
  199. }
  200. ]
  201. },
  202. "NewPet": {
  203. "type": "object",
  204. "required": [
  205. "name"
  206. ],
  207. "properties": {
  208. "name": {
  209. "type": "string"
  210. },
  211. "tag": {
  212. "type": "string"
  213. }
  214. }
  215. },
  216. "ErrorModel": {
  217. "type": "object",
  218. "required": [
  219. "code",
  220. "message"
  221. ],
  222. "properties": {
  223. "code": {
  224. "type": "integer",
  225. "format": "int32"
  226. },
  227. "message": {
  228. "type": "string"
  229. }
  230. }
  231. }
  232. }
  233. }