forked from Fintan-contents/mobile-app-hands-on-backend
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopenapi.yaml
168 lines (168 loc) · 4.04 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
openapi: 3.0.3
info:
title: ToDo REST API
version: '1.0.0'
description: ToDoアプリのREST API。
tags:
- name: todos
description: ToDo管理
servers:
- url: 'http://localhost:9080/api'
paths:
/todos:
get:
summary: ToDo一覧の取得
description: >
登録しているToDoを全て取得する。
tags:
- todos
operationId: getTodos
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Todo'
examples:
example:
value:
- id: 2001
text: やること1
completed: true
- id: 2002
text: やること2
completed: false
empty:
value: []
post:
summary: ToDoの登録
tags:
- todos
description: >
ToDoを登録する。
operationId: postTodo
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewTodo'
examples:
example:
value:
text: やること3
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
examples:
example:
value:
id: 2003
text: やること3
completed: false
'400':
description: Bad Request
'/todos/{todoId}':
parameters:
- name: todoId
in: path
description: ToDoのID
required: true
schema:
type: number
example: '2002'
put:
summary: ToDoステータスの更新
description: >
ToDoのステータスを更新する。
tags:
- todos
operationId: putTodo
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TodoStatus'
examples:
example:
value:
completed: true
responses:
'201':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
examples:
example:
value:
id: 2002
text: やること2
completed: true
'400':
description: Bad Request
'404':
description: Not Found
delete:
summary: ToDoの削除
description: >
登録しているToDoを削除する。
tags:
- todos
operationId: deleteTodo
responses:
'204':
description: No Content
components:
schemas:
Todo:
title: Todo
type: object
description: ToDo情報
properties:
id:
type: integer
description: ToDoのID
text:
type: string
description: ToDoのタイトル
completed:
type: boolean
description: ToDoのステータス
required:
- id
- text
- completed
additionalProperties: false
NewTodo:
title: NewTodo
type: object
description: ToDoの登録情報
properties:
text:
type: string
description: ToDoの内容
required:
- text
additionalProperties: false
TodoStatus:
title: TodoStatus
type: object
description: ToDoのステータス
properties:
completed:
type: boolean
description: ToDoのステータス
required:
- completed
additionalProperties: false
securitySchemes: {}