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