UNPKG

8.47 kBJSONView Raw
1{
2 "swagger": "2.0",
3 "info": {
4 "version": "1.7.1",
5 "title": "Examples",
6 "description": "Routes that have been enabled in the application."
7 },
8 "basePath": "/",
9 "schemes": [
10 "http",
11 "https"
12 ],
13 "consumes": [
14 "application/vnd.api+json"
15 ],
16 "produces": [
17 "application/vnd.api+json"
18 ],
19 "paths": {
20 "/login": {
21 "post": {
22 "summary": "Create a new session.",
23 "operationId": "loginPost",
24 "tags": [
25 "Login"
26 ],
27 "parameters": [
28 {
29 "name": "json",
30 "in": "body",
31 "schema": {
32 "$ref": "#/definitions/LoginPost"
33 }
34 }
35 ],
36 "responses": {
37 "200": {
38 "description": "Success",
39 "schema": {
40 "$ref": "#/definitions/LoginSuccess"
41 }
42 },
43 "403": {
44 "description": "Forbidden"
45 },
46 "422": {
47 "description": "Unprocessable Entity",
48 "schema": {
49 "$ref": "#/definitions/ValidationError"
50 }
51 }
52 }
53 }
54 },
55 "/user": {
56 "post": {
57 "summary": "Create a new user.",
58 "operationId": "userPost",
59 "tags": [
60 "User"
61 ],
62 "parameters": [
63 {
64 "name": "json",
65 "in": "body",
66 "schema": {
67 "$ref": "#/definitions/UserPost"
68 }
69 }
70 ],
71 "responses": {
72 "201": {
73 "description": "Success",
74 "schema": {
75 "$ref": "#/definitions/UserGetOne"
76 }
77 },
78 "401": {
79 "description": "Unauthorized"
80 },
81 "422": {
82 "description": "Unprocessable Entity",
83 "schema": {
84 "$ref": "#/definitions/ValidationError"
85 }
86 }
87 }
88 },
89 "get": {
90 "summary": "List all users.",
91 "operationId": "userGetAll",
92 "tags": [
93 "User"
94 ],
95 "responses": {
96 "200": {
97 "description": "Success",
98 "schema": {
99 "$ref": "#/definitions/UserGetAll"
100 }
101 },
102 "401": {
103 "description": "Unauthorized"
104 }
105 }
106 }
107 },
108 "/user/00000000-0000-0000-0000-000000000001": {
109 "get": {
110 "summary": "List one user.",
111 "operationId": "userGetOne",
112 "tags": [
113 "User"
114 ],
115 "responses": {
116 "200": {
117 "description": "Success",
118 "schema": {
119 "$ref": "#/definitions/UserGetOne"
120 }
121 },
122 "401": {
123 "description": "Unauthorized"
124 },
125 "422": {
126 "description": "Unprocessable Entity",
127 "schema": {
128 "$ref": "#/definitions/ValidationError"
129 }
130 }
131 }
132 },
133 "patch": {
134 "summary": "Update a user (property)",
135 "operationId": "userPatch",
136 "tags": [
137 "User"
138 ],
139 "parameters": [
140 {
141 "name": "json",
142 "in": "body",
143 "schema": {
144 "$ref": "#/definitions/UserPatch"
145 }
146 }
147 ],
148 "responses": {
149 "204": {
150 "description": "Success"
151 },
152 "401": {
153 "description": "Unauthorized"
154 },
155 "422": {
156 "description": "Unprocessable Entity",
157 "schema": {
158 "$ref": "#/definitions/ValidationError"
159 }
160 }
161 }
162 },
163 "put": {
164 "summary": "Update a user (resource)",
165 "operationId": "userPut",
166 "tags": [
167 "User"
168 ],
169 "parameters": [
170 {
171 "name": "json",
172 "in": "body",
173 "schema": {
174 "$ref": "#/definitions/UserPut"
175 }
176 }
177 ],
178 "responses": {
179 "204": {
180 "description": "Success"
181 },
182 "401": {
183 "description": "Unauthorized"
184 },
185 "422": {
186 "description": "Unprocessable Entity",
187 "schema": {
188 "$ref": "#/definitions/ValidationError"
189 }
190 }
191 }
192 },
193 "delete": {
194 "summary": "Delete a user.",
195 "operationId": "userDelete",
196 "tags": [
197 "User"
198 ],
199 "responses": {
200 "204": {
201 "description": "Success"
202 },
203 "401": {
204 "description": "Unauthorized"
205 },
206 "422": {
207 "description": "Unprocessable Entity",
208 "schema": {
209 "$ref": "#/definitions/ValidationError"
210 }
211 }
212 }
213 }
214 }
215 },
216 "definitions": {
217 "LoginPost": {
218 "type": "object",
219 "properties": {
220 "username": {
221 "type": "string",
222 "example": "foo"
223 },
224 "password": {
225 "type": "string",
226 "example": "bar"
227 }
228 }
229 },
230 "LoginSuccess": {
231 "type": "object",
232 "properties": {
233 "session": {
234 "type": "object",
235 "properties": {
236 "role": {
237 "type": "string"
238 }
239 }
240 }
241 }
242 },
243 "UserGetAll": {
244 "type": "object",
245 "properties": {
246 "data": {
247 "type": "array",
248 "items": {
249 "type": "object",
250 "properties": {
251 "type": {
252 "type": "string"
253 },
254 "id": {
255 "type": "string"
256 },
257 "attributes": {
258 "type": "object",
259 "properties": {
260 "name": {
261 "type": "string"
262 },
263 "age": {
264 "type": "string"
265 },
266 "gender": {
267 "type": "string"
268 }
269 }
270 }
271 }
272 }
273 }
274 }
275 },
276 "UserGetOne": {
277 "type": "object",
278 "properties": {
279 "data": {
280 "type": "object",
281 "properties": {
282 "type": {
283 "type": "string"
284 },
285 "id": {
286 "type": "string"
287 },
288 "attributes": {
289 "type": "object",
290 "properties": {
291 "name": {
292 "type": "string"
293 },
294 "age": {
295 "type": "string"
296 },
297 "gender": {
298 "type": "string"
299 }
300 }
301 }
302 }
303 }
304 }
305 },
306 "UserPost": {
307 "type": "object",
308 "properties": {
309 "name": {
310 "type": "string",
311 "example": "foo bar"
312 },
313 "age": {
314 "type": "number",
315 "example": 45
316 },
317 "gender": {
318 "type": "string",
319 "example": "Binary"
320 }
321 }
322 },
323 "UserPatch": {
324 "type": "object",
325 "properties": {
326 "name": {
327 "type": "string",
328 "example": "foo bar"
329 },
330 "age": {
331 "type": "number",
332 "example": 45
333 },
334 "gender": {
335 "type": "string",
336 "example": "Binary"
337 }
338 }
339 },
340 "UserPut": {
341 "type": "object",
342 "properties": {
343 "name": {
344 "type": "string",
345 "example": "biz baz"
346 }
347 }
348 },
349 "ValidationError": {
350 "type": "object",
351 "properties": {
352 "errors": {
353 "type": "array",
354 "items": {
355 "type": "object",
356 "properties": {
357 "title": {
358 "type": "string",
359 "example": "Invalid parameter"
360 },
361 "details": {
362 "type": "string",
363 "example": "Allowed values: Numeric characters"
364 },
365 "source": {
366 "type": "object",
367 "properties": {
368 "param": {
369 "type": "string",
370 "example": "age"
371 }
372 }
373 }
374 }
375 }
376 }
377 }
378 }
379 }
380}