-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yaml
542 lines (542 loc) · 15.3 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
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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
openapi: 3.0.1
info:
title: Pixi App API
description: Pixi Photo Sharing API
contact:
email: [email protected]
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.0
servers:
- url: http://localhost:8090/
- url: https://localhost:4443/
tags:
- name: admins
description: Secured Admin-only calls
- name: users
description: Operations available to regular, logged in users
- name: anyone
description: Operations available to anyone
paths:
/api/register:
post:
tags:
- anyone
summary: register for an account and receive token
description:
user supplies email and password to register and receives a json
web token.
operationId: register
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/UserRegistrationData"
required: true
responses:
200:
description: successfully registered, token received
content:
application/json:
schema:
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
token:
maxLength: 700
pattern: ^([a-zA-Z0-9_=]{4,})\.([a-zA-Z0-9_=]{4,})\.([a-zA-Z0-9_\-\+\/=]{4,})
type: string
409:
description: email address already registered
content:
application/json:
schema:
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
default:
description: unexpected error
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.@:-]{1,255}$
type: string
x-42c-no-authentication: true
x-42c-sensitivity: 5
x-codegen-request-body-name: user
/api/login:
post:
tags:
- anyone
summary: login successfully and receive json web token.
description: user supplies user name and password and receives a json web token
operationId: authenticate
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/UserRegistrationData"
responses:
200:
description: ""
content:
application/json:
schema:
required:
- message
- token
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
token:
maxLength: 700
pattern: ^([a-zA-Z0-9_=]{4,})\.([a-zA-Z0-9_=]{4,})\.([a-zA-Z0-9_\-\+\/=]{4,})
type: string
x-42c-local-strategy:
x-42c-strategy:
protections:
- security-headers_0.1:
hsts.max_age: 15400
csp.policy: "default-src: 'self'; upgrade-insecure-requests; block-all-mixed-content"
406:
description: successfully request, but invalid password
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
422:
description: missing parameters
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
default:
description: unexpected error
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.@:-]{1,255}$
type: string
x-42c-no-authentication: true
x-42c-sensitivity: 2
/api/user/info:
get:
tags:
- users
summary: get user information
description: user supplies valid token and receives all user info
operationId: userinfo
parameters:
- name: x-access-token
in: header
description: Users JWT Token
required: true
schema:
maxLength: 700
pattern: ^([a-zA-Z0-9_=]{4,})\.([a-zA-Z0-9_=]{4,})\.([a-zA-Z0-9_\-\+\/=]{4,})
type: string
responses:
200:
description: successful authentication sent user information
content:
application/json:
schema:
maxItems: 1
minItems: 1
type: array
items:
$ref: "#/components/schemas/UsersItem"
403:
description: invalid or missing token
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
default:
description: unexpected error
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
security:
- access-token: []
/api/user/edit_info:
put:
tags:
- users
summary: edit user information
description: user supplies valid token and updates all user info
operationId: edituserinfo
parameters:
- name: x-access-token
in: header
required: true
schema:
maxLength: 700
pattern: ^([a-zA-Z0-9_=]{4,})\.([a-zA-Z0-9_=]{4,})\.([a-zA-Z0-9_\-\+\/=]{4,})
type: string
requestBody:
description: userobject
content:
application/json:
schema:
$ref: "#/components/schemas/UserUpdateData"
required: true
responses:
200:
description: successful authentication sent user information
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
403:
description: invalid or missing token
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
default:
description: unexpected error
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
security:
- access-token: []
x-codegen-request-body-name: user
/api/admin/users/search:
get:
tags:
- admins
summary: search for a specific user
description: search for a specific user
operationId: userSearch
parameters:
- name: x-access-token
in: header
required: true
schema:
maxLength: 700
pattern: ^([a-zA-Z0-9_=]{4,})\.([a-zA-Z0-9_=]{4,})\.([a-zA-Z0-9_\-\+\/=]{4,})
type: string
- name: search
in: query
description: search query ?search=xxx
required: true
schema:
maxLength: 50
minLength: 4
pattern: ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$
type: string
responses:
200:
description: successful authentication user photo json object
content:
application/json:
schema:
maxItems: 50
minItems: 0
type: array
items:
$ref: "#/components/schemas/UsersItem"
403:
description: invalid or missing token
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
default:
description: unexpected error
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
security:
- access-token: []
/api/admin/all_users:
get:
tags:
- admins
summary: Returns the list of ALL users. Must be admin to call.
description: Returns the list of ALL users. Must be admin to call.
operationId: adminallusers
parameters:
- name: x-access-token
in: header
required: true
schema:
maxLength: 700
pattern: ^([a-zA-Z0-9_=]{4,})\.([a-zA-Z0-9_=]{4,})\.([a-zA-Z0-9_\-\+\/=]{4,})
type: string
responses:
200:
description: ""
content:
application/json:
schema:
maxItems: 50
minItems: 1
type: array
items:
$ref: "#/components/schemas/UsersListItem"
403:
description: invalid or missing token
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
default:
description: unexpected error
content:
application/json:
schema:
required:
- message
type: object
properties:
message:
maxLength: 255
minLength: 1
pattern: ^[\w\s\.\-@:,;]{1,255}$
type: string
security:
- access-token: []
components:
schemas:
UsersItem:
required:
- pass
- user
type: object
properties:
user:
maxLength: 50
minLength: 4
pattern: ^([a-zA-Z0-9_\-\.]+)(@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}))?$
type: string
format: email
example: [email protected]
pass:
maxLength: 12
minLength: 4
pattern: ^[a-zA-Z0-9&@#!?]{4,12}$
type: string
format: string
example: p@ssword1
name:
maxLength: 50
minLength: 5
pattern: (^[\w\s\.]{5,50}$)
type: string
example: Johnny Appleseed
is_admin:
type: boolean
description: is admin
account_balance:
maximum: 1E+3
minimum: 0
type: number
description: remaining balance
format: float
UsersListItem:
required:
- name
- user
type: object
properties:
user:
maxLength: 50
minLength: 4
pattern: ^([a-zA-Z0-9_\-\.]+)(@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}))?$
type: string
format: email
example: [email protected]
name:
maxLength: 30
minLength: 5
pattern: (^[\w\s\.]{5,30}$)
type: string
example: Johnny Appleseed
account_balance:
maximum: 1E+3
minimum: 0
type: number
description: remaining balance
format: float
UserUpdateData:
required:
- account_balance
- is_admin
- name
- pass
- user
type: object
properties:
user:
maxLength: 50
minLength: 4
pattern: ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$
type: string
format: email
pass:
maxLength: 12
minLength: 4
pattern: ^[a-zA-Z0-9&@#!?]{4,12}$
type: string
name:
maxLength: 30
minLength: 5
pattern: ^[\w\s\.]{5,30}$
type: string
is_admin:
type: boolean
account_balance:
maximum: 1E+3
minimum: 0
type: number
format: float
UserRegistrationData:
required:
- account_balance
- is_admin
- name
- pass
- user
type: object
properties:
user:
maxLength: 50
minLength: 4
pattern: ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$
type: string
format: email
pass:
maxLength: 12
minLength: 4
pattern: ^[a-zA-Z0-9&@#!?]{4,12}$
type: string
name:
maxLength: 30
minLength: 5
pattern: ^[\w\s\.]{5,30}$
type: string
is_admin:
type: boolean
account_balance:
maximum: 1000
minimum: 0
type: integer
format: int32
securitySchemes:
access-token:
type: apiKey
description: Most operations need to pass a user token retrieved calling /api/login
name: x-access-token
in: header