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