petstore-simple.json 5.1 KB

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