-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yaml
127 lines (127 loc) · 2.77 KB
/
swagger.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
swagger: '2.0'
info:
title: Desafio Precato
version: 1.0.0
basePath: /
schemes:
- http
consumes:
- application/json
produces:
- application/json
paths:
/users:
get:
description: Retorna todos os usuários
responses:
'200':
description: Ok
schema:
type: array
items:
$ref: '#/definitions/User'
post:
description: Cria um novo usuário
parameters:
- in: body
name: body
description: Objeto User para ser criado
required: true
schema:
$ref: '#/definitions/UserInput'
responses:
'201':
description: Created
schema:
$ref: '#/definitions/User'
/users/{id}:
parameters:
- in: path
name: id
type: string
required: true
description: Id do usuário a ser buscado
put:
description: Atualiza um usuário
parameters:
- in: body
name: body
description: Objeto User para ser atualizado
required: true
schema:
$ref: '#/definitions/UserInput'
responses:
'200':
description: Ok
schema:
$ref: '#/definitions/User'
'404':
description: Not Found
delete:
description: Deleta um usuário
responses:
'200':
description: Ok
'404':
description: Not Found
/users/{start_date}/{end_date}:
parameters:
- in: path
name: start_date
type: string
required: true
description: Data inicial para busca, formato - YYYY-MM-DD
- in: path
name: end_date
type: string
required: true
description: Data final para busca, formato - YYYY-MM-DD
get:
description: Retorna usuários criados entre as datas informadas
responses:
'200':
description: Ok
schema:
type: array
items:
$ref: '#/definitions/User'
'400':
description: Bad Request
schema:
type: object
properties:
error:
type: string
example:
error: 'dates required!'
definitions:
User:
type: object
properties:
_id:
type: string
name:
type: string
email:
type: string
cpf:
type: string
phone:
type: string
created_at:
type: string
UserInput:
type: object
properties:
name:
type: string
required: true
email:
type: string
required: true
cpf:
type: string
required: true
phone:
type: string
required: true