-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yaml
266 lines (262 loc) · 7.01 KB
/
openapi.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
openapi: "3.0.2"
info:
title: Todos API
description: Documentation of a simple Todos API
version: 0.0.2
servers:
- url: https://soryo-fastify-todo.herokuapp.com
description: Production
- url: localhost
description: Development server
tags:
- name: todo
description: Todo related end-points
- name: tag
description: Tag related end-points
- name: healthcheck
description: Tag for internal healthcheck routes
paths:
/v1/todos:
get:
summary: List all the todos
description: List all the todos of the user provided in the query parameters
operationId: listTodos
tags:
- todo
parameters:
- name: ownerUuid
in: query
required: true
schema:
type: string
responses:
"200":
description: Successfully retrieved all the todos
content:
"application/json":
schema:
type: array
items:
$ref: "#/components/schemas/Todo"
example:
- uuid: 3d780d09-c520-4817-b430-ce849bcc5423
ownerUuid: 535d6711-2ec0-4ba7-9f34-3d13f25de822
title: Groceries
state: ACTIVE
"400":
$ref: "#/components/responses/BadRequest"
"429":
$ref: "#/components/responses/RateLimited"
post:
summary: Create a new todo
description: Create a new todo
operationId: createTodo
tags:
- todo
requestBody:
description: New todo payload
content:
"application/json":
schema:
$ref: "#/components/schemas/Todo"
responses:
"200":
description: Successfully created a new todo
content:
"application/json":
schema:
$ref: "#/components/schemas/Todo"
links:
GetTodoByUuid:
$ref: "#/components/links/GetTodoByUuid"
"400":
$ref: "#/components/responses/BadRequest"
"429":
$ref: "#/components/responses/RateLimited"
/v1/todos/{todoUuid}:
get:
summary: Get a todo
description: Get a todo by providing its uuid
operationId: getTodo
tags:
- todo
parameters:
- name: ownerUuid
in: query
required: true
schema:
type: string
- name: todoUuid
required: true
in: path
schema:
type: string
responses:
"200":
description: Successfully retrieved the todo
content:
"application/json":
schema:
$ref: "#/components/schemas/Todo"
"400":
$ref: "#/components/responses/BadRequest"
"404":
description: Couldn't find the todo with the provided uuid
"429":
$ref: "#/components/responses/RateLimited"
put:
summary: Update a todo
description: Update a todo by providing its uuid and the updated todo content
operationId: updateTodo
tags:
- todo
parameters:
- name: ownerUuid
in: query
required: true
schema:
type: string
- name: todoUuid
required: true
in: path
schema:
type: string
requestBody:
description: New todo payload
content:
"application/json":
schema:
$ref: "#/components/schemas/Todo"
responses:
"200":
description: Successful response
content:
"application/json":
schema:
$ref: "#/components/schemas/Todo"
"400":
$ref: "#/components/responses/BadRequest"
"429":
$ref: "#/components/responses/RateLimited"
delete:
summary: Delete a todo
description: Delete a todo by providing its uuid
operationId: deleteTodo
tags:
- todo
parameters:
- name: todoUuid
required: true
in: path
schema:
type: string
- name: ownerUuid
in: query
required: true
schema:
type: string
- name: hard
description: >
Defines if the deletion is a "hard" delete (true) or a "soft" delete (false or not present)
in: query
required: false
schema:
type: boolean
responses:
"204":
description: Successful response
"400":
$ref: "#/components/responses/BadRequest"
/ready:
get:
summary: Get the readiness of the service
operationId: isReady
tags:
- healthcheck
responses:
"200":
description: Service is ready
"503":
description: Service isn't ready yet
/healthy:
get:
summary: Get the healthiness of the service
operationId: isHealthy
tags:
- healthcheck
responses:
"200":
description: Service is healthy
"503":
description: Service isn't healthy
components:
schemas:
Todo:
type: object
properties:
uuid:
description: Unique identifier of the todo
type: string
ownerUuid:
description: Unique identifier of the owner of the todo
type: string
title:
description: Title/short summary of the todo
type: string
state:
description: State of the todo
type: string
enum:
- "ACTIVE"
- "COMPLETED"
- "DELETED"
description:
description: The lengthy description of this todo
type: string
required:
- uuid
- "ownerUuid"
- "title"
- "state"
example:
uuid: 3d780d09-c520-4817-b430-ce849bcc5423
ownerUuid: 535d6711-2ec0-4ba7-9f34-3d13f25de822
title: Groceries
state: ACTIVE
Error:
type: object
properties:
statusCode:
description: Status code of the response
type: number
error:
description: Name of the error
type: string
message:
description: Explanation of the error
type: string
example:
statusCode: 400
error: "Bad Request"
message: "querystring must have required property 'ownerUuid'"
responses:
BadRequest:
description: Request badly formatted
content:
"application/json":
schema:
$ref: "#/components/schemas/Error"
RateLimited:
description: Too many requests were sent
content:
"application/json":
schema:
$ref: "#/components/schemas/Error"
links:
GetTodoByUuid:
operationId: getTodo
parameters:
todoUuid: "$response.body#/uuid"
description: >
The `uuid` value returned in the response can be used as
the `todoUuid` parameter in `GET /todos/{todoUuid}`.