-
Notifications
You must be signed in to change notification settings - Fork 0
/
openAPI.yaml
106 lines (106 loc) · 2.66 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
openapi: 3.0.0
info:
title: Ekadashi-server
version: 0.0.1
paths:
/register:
post:
summary: Register a new user in ekadashi database.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterRequest'
responses:
'200':
description: Registration succeed
'400':
description: Incorrect username or password
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Incorrect username or password
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/login:
post:
summary: Login user
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/LoginRequest'
responses:
'200':
description: Login succeed
headers:
Set-Cookie:
schema:
type: string
example: session_token=abcde12345
'400':
description: Cannot decode user
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Incorrect username or password
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/ekadashi/next:
get:
security:
- cookieAuth: []
summary: Show next ekadashi day
responses:
'200':
description: OK
content:
application/json:
schema:
type: string
'500':
description: Internal server error
components:
schemas:
RegisterRequest:
allOf:
- $ref: '#/components/schemas/LoginRequest'
LoginRequest:
properties:
username:
type: string
minLength: 6
nullable: false
pattern: '`^[a-zA-Z1-9]+$`'
password:
type: string
minLength: 6
nullable: false
pattern: '`^[a-zA-Z1-9]+$`'
required:
- 'username'
- 'password'
ErrorResponse:
properties:
reason:
type: string
securitySchemes:
cookieAuth:
type: apiKey
in: cookie
name: 'session_token'