Repository navigation
Expand file tree
/
Copy pathopenapi-4-server.yaml
More file actions
315 lines (315 loc) · 10.6 KB
/
Copy pathopenapi-4-server.yaml
File metadata and controls
315 lines (315 loc) · 10.6 KB
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
openapi: 3.0.1
info:
title: Openapi demo
description: 多文件 openapi 声明模板
contact:
email: rong.w.tang@outlook.com
version: 1.0.0
servers:
- url: http://candycloud.cc
tags:
- name: Session
description: 用户认证
paths:
/session/login:
post:
tags:
- Session
summary: 用户登录
security: []
operationId: login
responses:
'200':
description: 服务器成功处理了请求,有返回数据
'204':
description: 已成功登录,请保存 Authorization 中的 JWT 信息
headers:
Authorization:
description: JWT 承载字段
required: true
schema:
type: string
'401':
description: 服务器已经理解请求,但是拒绝执行它。当前请求需要用户验证。
'403':
description: 服务器已经理解请求,但是拒绝执行它。没有访问资源所需的权限。
'404':
description: 请求所希望得到的资源未被在服务器上发现。
'408':
description: 请求超时。
'415':
description: 对于当前请求的方法和所请求的资源,请求中提交的实体并不是服务器中所支持的格式,因此请求被拒绝。
'422':
description: 请求格式正确,但是由于含有语义错误,无法响应。错误信息包含在返回的消息体中。
'500':
description: 服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理。
/session/login/code:
post:
tags:
- Session
summary: 发送手机登录校验码
security: []
operationId: sendLoginVerificationCode
parameters:
- name: phone
in: query
description: 手机号码
required: true
schema:
$ref: '#/components/schemas/PhoneNumber'
responses:
'200':
description: 服务器成功处理了请求,有返回数据
'204':
description: 服务器成功处理了请求,没有返回数据
'401':
description: 服务器已经理解请求,但是拒绝执行它。当前请求需要用户验证。
'403':
description: 服务器已经理解请求,但是拒绝执行它。没有访问资源所需的权限。
'404':
description: 请求所希望得到的资源未被在服务器上发现。
'408':
description: 请求超时。
'415':
description: 对于当前请求的方法和所请求的资源,请求中提交的实体并不是服务器中所支持的格式,因此请求被拒绝。
'422':
description: 请求格式正确,但是由于含有语义错误,无法响应。错误信息包含在返回的消息体中。
'500':
description: 服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理。
/session/logout:
post:
tags:
- Session
summary: 退出登录
operationId: logout
responses:
'200':
description: 服务器成功处理了请求,有返回数据
'204':
description: 服务器成功处理了请求,没有返回数据
'401':
description: 服务器已经理解请求,但是拒绝执行它。当前请求需要用户验证。
'403':
description: 服务器已经理解请求,但是拒绝执行它。没有访问资源所需的权限。
'404':
description: 请求所希望得到的资源未被在服务器上发现。
'408':
description: 请求超时。
'415':
description: 对于当前请求的方法和所请求的资源,请求中提交的实体并不是服务器中所支持的格式,因此请求被拒绝。
'422':
description: 请求格式正确,但是由于含有语义错误,无法响应。错误信息包含在返回的消息体中。
'500':
description: 服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理。
/session/refreshToken:
post:
tags:
- Session
summary: 刷新 Token
operationId: refreshToken
responses:
'200':
description: 服务器成功处理了请求,有返回数据
'204':
description: token 已刷新,请保存 Authorization 中的 JWT 信息
headers:
Authorization:
description: JWT 承载字段
required: true
schema:
type: string
'401':
description: 服务器已经理解请求,但是拒绝执行它。当前请求需要用户验证。
'403':
description: 服务器已经理解请求,但是拒绝执行它。没有访问资源所需的权限。
'404':
description: 请求所希望得到的资源未被在服务器上发现。
'408':
description: 请求超时。
'415':
description: 对于当前请求的方法和所请求的资源,请求中提交的实体并不是服务器中所支持的格式,因此请求被拒绝。
'422':
description: 请求格式正确,但是由于含有语义错误,无法响应。错误信息包含在返回的消息体中。
'500':
description: 服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理。
/session/register:
post:
tags:
- Session
summary: 用户注册
security: []
operationId: register
responses:
'200':
description: 服务器成功处理了请求,有返回数据
'204':
description: OK
headers:
Authorization:
description: JWT 承载字段
required: true
schema:
type: string
'401':
description: 服务器已经理解请求,但是拒绝执行它。当前请求需要用户验证。
'403':
description: 服务器已经理解请求,但是拒绝执行它。没有访问资源所需的权限。
'404':
description: 请求所希望得到的资源未被在服务器上发现。
'408':
description: 请求超时。
'415':
description: 对于当前请求的方法和所请求的资源,请求中提交的实体并不是服务器中所支持的格式,因此请求被拒绝。
'422':
description: 请求格式正确,但是由于含有语义错误,无法响应。错误信息包含在返回的消息体中。
'500':
description: 服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理。
/session/register/code:
post:
tags:
- Session
summary: 发送手机注册校验码
security: []
operationId: sendRegisterVerificationCode
parameters:
- name: phone
in: query
description: 手机号码
required: true
schema:
$ref: '#/components/schemas/PhoneNumber'
responses:
'200':
description: 服务器成功处理了请求,有返回数据
'204':
description: 服务器成功处理了请求,没有返回数据
'401':
description: 服务器已经理解请求,但是拒绝执行它。当前请求需要用户验证。
'403':
description: 服务器已经理解请求,但是拒绝执行它。没有访问资源所需的权限。
'404':
description: 请求所希望得到的资源未被在服务器上发现。
'408':
description: 请求超时。
'415':
description: 对于当前请求的方法和所请求的资源,请求中提交的实体并不是服务器中所支持的格式,因此请求被拒绝。
'422':
description: 请求格式正确,但是由于含有语义错误,无法响应。错误信息包含在返回的消息体中。
'500':
description: 服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理。
components:
schemas:
EFeedbackType:
type: string
description: |
意见反馈类型:
* `Function` - 功能问题
* `Optimization` - 优化建议
* `Other` - 其他反馈
enum:
- Function
- Optimization
- Other
example: Function
GUID:
type: string
pattern: ^\d+$
PhoneNumber:
type: string
pattern: ^\d+$
UserAccount:
type: object
required:
- name
- language
- id
properties:
name:
type: string
description: 姓名
avatar:
type: string
description: 头像
weChat:
type: string
description: 微信
language:
type: string
description: 语言
id:
type: string
pattern: ^\d+$
UserAccountBody:
type: object
required:
- name
- language
properties:
name:
type: string
description: 姓名
avatar:
type: string
description: 头像
weChat:
type: string
description: 微信
language:
type: string
description: 语言
responses:
UserAccount:
description: 用户基本信息
content:
application/json:
schema:
$ref: '#/components/schemas/UserAccount'
parameters:
IdInPath:
name: id
in: path
required: true
schema:
type: string
pattern: ^\d+$
PhoneNumberInQuery:
name: phone
in: query
description: 手机号码
required: true
schema:
type: string
pattern: ^\d+$
SearchKeywords:
name: s
in: query
description: 搜索词
schema:
type: string
requestBodies:
UserAccount:
description: 用户基本信息
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UserAccountBody'
headers:
Authorization:
description: JWT 承载字段
required: true
schema:
type: string
X-Appid:
description: 发起请求的客户端应用 id
required: true
schema:
type: string
pattern: ^\d+$
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
security:
- bearerAuth: []