-
Notifications
You must be signed in to change notification settings - Fork 1
/
openapi.yaml
312 lines (308 loc) · 7.97 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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
openapi: 3.0.0
info:
description: Simple Todo API
version: 3.0.0
title: Simple Todo API
contact:
email: [email protected]
components:
schemas:
TodoItem:
type: object
required:
- listId
- name
- description
description: A task that needs to be completed
properties:
id:
type: string
listId:
type: string
name:
type: string
description:
type: string
state:
$ref: "#/components/schemas/TodoState"
dueDate:
type: string
format: date-time
completedDate:
type: string
format: date-time
TodoList:
type: object
required:
- name
properties:
id:
type: string
name:
type: string
description:
type: string
description: " A list of related Todo items"
TodoState:
type: string
enum:
- todo
- inprogress
- done
parameters:
listId:
in: path
required: true
name: listId
description: The Todo list unique identifier
schema:
type: string
itemId:
in: path
required: true
name: itemId
description: The Todo item unique identifier
schema:
type: string
state:
in: path
required: true
name: state
description: The Todo item state
schema:
$ref: "#/components/schemas/TodoState"
top:
in: query
required: false
name: top
description: The max number of items to returns in a result
schema:
type: number
default: 20
skip:
in: query
required: false
name: skip
description: The number of items to skip within the results
schema:
type: number
default: 0
requestBodies:
TodoList:
description: The Todo List
content:
application/json:
schema:
$ref: "#/components/schemas/TodoList"
TodoItem:
description: The Todo Item
content:
application/json:
schema:
$ref: "#/components/schemas/TodoItem"
responses:
TodoList:
description: A Todo list result
content:
application/json:
schema:
$ref: "#/components/schemas/TodoList"
TodoListArray:
description: An array of Todo lists
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/TodoList"
TodoItem:
description: A Todo item result
content:
application/json:
schema:
$ref: "#/components/schemas/TodoItem"
TodoItemArray:
description: An array of Todo items
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/TodoItem"
paths:
/lists:
get:
operationId: GetLists
summary: Gets an array of Todo lists
tags:
- Lists
parameters:
- $ref: "#/components/parameters/top"
- $ref: "#/components/parameters/skip"
responses:
200:
$ref: "#/components/responses/TodoListArray"
post:
operationId: CreateList
summary: Creates a new Todo list
tags:
- Lists
requestBody:
$ref: "#/components/requestBodies/TodoList"
responses:
201:
$ref: "#/components/responses/TodoList"
400:
description: Invalid request schema
/lists/{listId}:
get:
operationId: GetListById
summary: Gets a Todo list by unique identifier
tags:
- Lists
parameters:
- $ref: "#/components/parameters/listId"
responses:
200:
$ref: "#/components/responses/TodoList"
404:
description: Todo list not found
put:
operationId: UpdateListById
summary: Updates a Todo list by unique identifier
tags:
- Lists
requestBody:
$ref: "#/components/requestBodies/TodoList"
parameters:
- $ref: "#/components/parameters/listId"
responses:
200:
$ref: "#/components/responses/TodoList"
404:
description: Todo list not found
400:
description: Todo list is invalid
delete:
operationId: DeleteListById
summary: Deletes a Todo list by unique identifier
tags:
- Lists
parameters:
- $ref: "#/components/parameters/listId"
responses:
204:
description: Todo list deleted successfully
404:
description: Todo list not found
/lists/{listId}/items:
post:
operationId: CreateItem
summary: Creates a new Todo item within a list
tags:
- Items
requestBody:
$ref: "#/components/requestBodies/TodoItem"
parameters:
- $ref: "#/components/parameters/listId"
responses:
201:
$ref: "#/components/responses/TodoItem"
404:
description: Todo list not found
get:
operationId: GetItemsByListId
summary: Gets Todo items within the specified list
tags:
- Items
parameters:
- $ref: "#/components/parameters/listId"
- $ref: "#/components/parameters/top"
- $ref: "#/components/parameters/skip"
responses:
200:
$ref: "#/components/responses/TodoItemArray"
404:
description: Todo list not found
/lists/{listId}/items/{itemId}:
get:
operationId: GetItemById
summary: Gets a Todo item by unique identifier
tags:
- Items
parameters:
- $ref: "#/components/parameters/listId"
- $ref: "#/components/parameters/itemId"
responses:
200:
$ref: "#/components/responses/TodoItem"
404:
description: Todo list or item not found
put:
operationId: UpdateItemById
summary: Updates a Todo item by unique identifier
tags:
- Items
requestBody:
$ref: "#/components/requestBodies/TodoItem"
parameters:
- $ref: "#/components/parameters/listId"
- $ref: "#/components/parameters/itemId"
responses:
200:
$ref: "#/components/responses/TodoItem"
400:
description: Todo item is invalid
404:
description: Todo list or item not found
delete:
operationId: DeleteItemById
summary: Deletes a Todo item by unique identifier
tags:
- Items
parameters:
- $ref: "#/components/parameters/listId"
- $ref: "#/components/parameters/itemId"
responses:
204:
description: Todo item deleted successfully
404:
description: Todo list or item not found
/lists/{listId}/items/state/{state}:
get:
operationId: GetItemsByListIdAndState
summary: Gets a list of Todo items of a specific state
tags:
- Items
parameters:
- $ref: "#/components/parameters/listId"
- $ref: "#/components/parameters/state"
- $ref: "#/components/parameters/top"
- $ref: "#/components/parameters/skip"
responses:
200:
$ref: "#/components/responses/TodoItemArray"
404:
description: Todo list or item not found
put:
operationId: UpdateItemsStateByListId
summary: Changes the state of the specified list items
tags:
- Items
requestBody:
description: unique identifiers of the Todo items to update
content:
application/json:
schema:
type: array
items:
description: The Todo item unique identifier
type: string
parameters:
- $ref: "#/components/parameters/listId"
- $ref: "#/components/parameters/state"
responses:
204:
description: Todo items updated
400:
description: Update request is invalid