Skip to content

Commit 4af1041

Browse files
more swagger docs
1 parent ddc4c33 commit 4af1041

3 files changed

Lines changed: 205 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ git clone https://github.com/SystangoTechnologies/Koach.git
4343
* [Babel](https://github.com/babel/babel)
4444
* [ESLint](http://eslint.org/)
4545
* [Gulp](https://github.com/gulpjs/gulp/)
46+
* [PM2](https://github.com/Unitech/pm2/)
47+
* [Swagger](https://github.com/swagger-api/)
4648

4749
## Structure
4850
```

swagger/swagger.json

Lines changed: 123 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
],
110110
"parameters": [
111111
{
112-
"name": "Body",
112+
"name": "User details",
113113
"in": "body",
114114
"required": true,
115115
"description": "User details",
@@ -254,6 +254,128 @@
254254
},
255255
"401": {
256256
"description": "Unauthorized"
257+
},
258+
"422": {
259+
"description": "Unprocessable Entity"
260+
}
261+
}
262+
},
263+
"put": {
264+
"tags": [
265+
"Users"
266+
],
267+
"security": [
268+
{
269+
"Bearer": []
270+
}
271+
],
272+
"summary": "Update user",
273+
"description": "Update User",
274+
"operationId": "updateUser",
275+
"produces": [
276+
"application/json"
277+
],
278+
"parameters": [
279+
{
280+
"name": "id",
281+
"in": "path",
282+
"type": "string",
283+
"required": true,
284+
"description": "User id"
285+
},
286+
{
287+
"name": "User details",
288+
"in": "body",
289+
"required": true,
290+
"description": "User details",
291+
"schema": {
292+
"type": "object",
293+
"properties": {
294+
"user": {
295+
"type": "object",
296+
"properties": {
297+
"name": {
298+
"descrpition": "Name",
299+
"type": "string"
300+
},
301+
"username": {
302+
"description": "Username",
303+
"type": "string"
304+
},
305+
"password": {
306+
"description": "Password",
307+
"type": "string"
308+
}
309+
}
310+
}
311+
},
312+
"required": [
313+
"user"
314+
]
315+
}
316+
}
317+
],
318+
"responses": {
319+
"200": {
320+
"type": "object",
321+
"properties": {
322+
"_id": {
323+
"type": "string"
324+
},
325+
"name": {
326+
"type": "string"
327+
},
328+
"username": {
329+
"type": "string"
330+
}
331+
}
332+
},
333+
"401": {
334+
"description": "Unauthorized"
335+
},
336+
"422": {
337+
"description": "Unprocessable Entity"
338+
}
339+
}
340+
},
341+
"delete": {
342+
"tags": [
343+
"Users"
344+
],
345+
"security": [
346+
{
347+
"Bearer": []
348+
}
349+
],
350+
"summary": "Delete user",
351+
"description": "Delete User",
352+
"operationId": "deleteUser",
353+
"produces": [
354+
"application/json"
355+
],
356+
"parameters": [
357+
{
358+
"name": "id",
359+
"in": "path",
360+
"type": "string",
361+
"required": true,
362+
"description": "User id"
363+
}
364+
],
365+
"responses": {
366+
"200": {
367+
"type": "object",
368+
"properties": {
369+
"success": {
370+
"type": "boolean"
371+
}
372+
}
373+
},
374+
"401": {
375+
"description": "Unauthorized"
376+
},
377+
"422": {
378+
"description": "Unprocessable Entity"
257379
}
258380
}
259381
}

swagger/swagger.yaml

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ paths:
7474
produces:
7575
- application/json
7676
parameters:
77-
- name: Body
77+
- name: User details
7878
in: body
7979
required: true
8080
description: 'User details'
@@ -169,3 +169,82 @@ paths:
169169
type: string
170170
'401':
171171
description: Unauthorized
172+
'422':
173+
description: Unprocessable Entity
174+
put:
175+
tags:
176+
- Users
177+
security:
178+
- Bearer: []
179+
summary: Update user
180+
description: Update User
181+
operationId: updateUser
182+
produces:
183+
- application/json
184+
parameters:
185+
- name: id
186+
in: path
187+
type: string
188+
required: true
189+
description: 'User id'
190+
- name: User details
191+
in: body
192+
required: true
193+
description: 'User details'
194+
schema:
195+
type: object
196+
properties:
197+
user:
198+
type: object
199+
properties:
200+
name:
201+
descrpition: 'Name'
202+
type: string
203+
username:
204+
description: 'Username'
205+
type: string
206+
password:
207+
description: 'Password'
208+
type: string
209+
required:
210+
- user
211+
responses:
212+
'200':
213+
type: object
214+
properties:
215+
_id:
216+
type: string
217+
name:
218+
type: string
219+
username:
220+
type: string
221+
'401':
222+
description: Unauthorized
223+
'422':
224+
description: Unprocessable Entity
225+
delete:
226+
tags:
227+
- Users
228+
security:
229+
- Bearer: []
230+
summary: Delete user
231+
description: Delete User
232+
operationId: deleteUser
233+
produces:
234+
- application/json
235+
parameters:
236+
- name: id
237+
in: path
238+
type: string
239+
required: true
240+
description: 'User id'
241+
responses:
242+
'200':
243+
type: object
244+
properties:
245+
success:
246+
type: boolean
247+
'401':
248+
description: Unauthorized
249+
'422':
250+
description: Unprocessable Entity

0 commit comments

Comments
 (0)