forked from tughril/swagger-ts-gen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yml
341 lines (341 loc) · 8.39 KB
/
swagger.yml
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
swagger: '2.0'
info:
title: pool
version: '1.0'
host: 'localhost:8509'
schemes:
- https
produces:
- application/json
consumes:
- application/json
tags:
- name: token
description: Oauth2のトークン
- name: email-verifications
description: メール認証
- name: phone-number-verifications
description: 電話番号認証
- name: users
description: ユーザ
paths:
/oauth2/token:
post:
summary: トークン発行
tags: [token]
operationId: issueToken
security: []
consumes:
- application/x-www-form-urlencoded
parameters:
- name: grant_type
in: formData
type: string
enum: [Bearer]
required: true
- name: username
in: formData
type: string
required: true
- name: password
in: formData
type: string
required: true
- name: mfa_id
in: formData
type: string
responses:
'201':
description: Accepted
schema:
$ref: '#/definitions/OAuth2Token'
'/email-verifications/{id}/check':
get:
summary: メール認証でのコード照合を行う
description: アプリのAPIクライアントではなく、メーラーが起動したブラウザが開くエンドポイント。認証メール内にリンクとして埋め込まれている。
operationId: checkEmailVerification
tags:
- email-verifications
security: []
parameters:
- name: "id"
in: "path"
description: "メール認証のid"
required: true
type: string
- name: "code"
in: "query"
description: "認証メール内に埋め込まれた認証用コード"
required: true
type: "string"
- name: "redirect_url"
in: "query"
description: "認証成功時にリダイレクトする先のURL"
required: true
type: "string"
pattern: https?://[\w!?/\+\-_~=;\.,*&@#$%\(\)\'\[\]]+
responses:
'302':
description: 照合成功時
headers:
Location:
type: string
description: 照合成功時の遷移先
'307':
description: 照合失敗時
headers:
Location:
type: string
description: 照合失敗時の遷移先
/phone-number-verifications:
post:
summary: 電話番号認証を要求する
operationId: createPhoneNumberVerification
tags:
- phone-number-verifications
security: []
parameters:
- name: body
in: body
required: true
schema:
$ref: '#/definitions/CreatePhoneNumberVerificationBody'
responses:
'201':
$ref: '#/responses/PhoneNumberVerification'
'/phone-number-verifications/{id}/check':
post:
summary: 電話番号認証でのコード照合を行う
operationId: checkPhoneNumberVerification
tags:
- phone-number-verifications
security: []
parameters:
- name: "id"
in: "path"
description: "電話番号認証のid"
required: true
type: "string"
- name: "body"
in: "body"
required: true
schema:
$ref: '#/definitions/CheckPhoneNumberVerificationBody'
responses:
'200':
$ref: '#/responses/PhoneNumberVerification'
/signup:
post:
summary: 新規会員登録
tags: [users]
operationId: signup
security: []
parameters:
- name: body
in: "body"
required: true
schema:
$ref: '#/definitions/SingupBody'
responses:
'202':
description: OK
schema:
type: object
properties:
token:
$ref: '#/definitions/Token'
'/users/me':
get:
summary: 自分のユーザ情報を取得する
operationId: showMe
tags:
- users
responses:
'200':
$ref: '#/responses/User'
'/users/me/email':
put:
summary: 自分のメールアドレスを変更する
operationId: changeMyEmail
tags:
- users
parameters:
- name: "body"
in: "body"
required: true
schema:
$ref: '#/definitions/ChangeMyEmailBody'
responses:
'202':
$ref: '#/responses/User'
'/users/me/phone-number':
put:
summary: 自分の電話番号を変更する
operationId: changeMyPhoneNumber
tags:
- users
parameters:
- name: "body"
in: "body"
required: true
schema:
$ref: '#/definitions/ChangeMyPhoneNumberBody'
responses:
'200':
$ref: '#/responses/User'
responses:
User:
description: ユーザ
schema:
$ref: '#/definitions/User'
EmailVerification:
description: メール認証
schema:
$ref: '#/definitions/EmailVerification'
PhoneNumberVerification:
description: 電話番号認証
schema:
$ref: '#/definitions/PhoneNumberVerification'
definitions:
User:
type: object
properties:
id:
type: integer
email:
type: string
phoneNumber:
$ref: '#/definitions/PhoneNumber'
OAuth2Token:
type: object
description: OAuth2の仕様に合わせるため、これのみスネークケースになっている。Tokenと同じ情報を持つ。
properties:
access_token:
type: string
token_type:
type: string
enum: [Bearer]
expires_in:
type: integer
Token:
type: object
properties:
accessToken:
type: string
tokenType:
type: string
enum: [Bearer]
expiresIn:
type: integer
EmailVerification:
type: object
properties:
id:
type: string
expiresIn:
type: integer
createdAt:
type: string
format: datetime
PhoneNumberVerification:
type: object
properties:
id:
type: string
status:
type: string
enum: [requested, verified]
expiresIn:
type: integer
createdAt:
type: string
format: datetime
verifiedAt:
type: string
format: datetime
x-nullable: true
SingupBody:
type: object
required:
- email
- password
- phoneNumber
- phoneNumberVerificationID
properties:
email:
$ref: '#/definitions/Email'
password:
$ref: '#/definitions/Password'
phoneNumber:
$ref: '#/definitions/PhoneNumber'
phoneNumberVerificationID:
type: string
CreatePhoneNumberVerificationBody:
type: object
required:
- phoneNumber
properties:
phoneNumber:
type: string
format: ^0[789]0[0-9]{8}$
CheckPhoneNumberVerificationBody:
type: object
required:
- verificationCode
properties:
verificationCode:
type: string
CreateEmailVerificationBody:
type: object
required:
- email
properties:
email:
type: string
format: email
ChangeMyEmailBody:
type: object
required:
- email
properties:
email:
type: string
format: email
ChangeMyPhoneNumberBody:
type: object
required:
- phoneNumber
- phoneNumberVerificationID
properties:
phoneNumber:
$ref: '#/definitions/PhoneNumber'
phoneNumberVerificationID:
type: string
Email:
type: string
format: email
Password:
type: string
format: ^[0-9A-Za-z!-~]{8,40}$
example: sekai-no-8maki
PhoneNumber:
type: string
format: ^0[789]0[0-9]{8}$
example: 08012345678
basePath: /v1
securityDefinitions:
OAuth2:
type: oauth2
flow: password
tokenUrl: https://localhost:8509/v1/oauth2/token
scopes:
read: Grant read-only access to all your data except for the account and user info
write: Grant write-only access to all your data except for the account and user info
profile: Grant read-only access to the account and user info only
Authorization:
type: apiKey
in: header
description: ''
name: Bearer Oauth2 Token
security:
- Authorization: []