-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathopenapi.yaml
165 lines (165 loc) · 3.99 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
openapi: 3.0.1
info:
title: Typescript Service
version: 1.0.0
description: Template for writing a service
paths:
/users:
patch:
operationId: usersPatch
tags:
- Users
summary: Edit users
parameters:
- name: id
in: query
required: true
description: Edit these specific users
schema:
type: array
items:
$ref: '#/components/schemas/UserID'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserEdit'
responses:
200:
description: Created
content:
application/json:
schema:
type: object
required:
- usersAffected
properties:
usersAffected:
type: integer
post:
operationId: usersPost
tags:
- Users
summary: Create a user
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserCreate'
responses:
200:
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/User'
get:
operationId: usersGet
tags:
- Users
summary: Get the list of all users
parameters:
- name: q
in: query
description: Search for users by name
schema:
type: string
maxLength: 100
- name: id
in: query
description: Fetch users by ID
schema:
type: array
items:
$ref: '#/components/schemas/UserID'
- name: count
in: query
schema:
type: integer
default: 20
minimum: 1
- name: page
in: query
description: Fetch users before this cursor
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
additionalProperties: false
required:
- users
properties:
users:
type: array
items:
$ref: '#/components/schemas/User'
nextPageCursor:
type: string
description: Use to fetch the next page
components:
schemas:
UserCreate:
type: object
required:
- name
- age
properties:
name:
type: string
description: Name of the user
example: Jack Daniels
maxLength: 200
age:
type: integer
description: Age of user
minimum: 0
maximum: 150
UserEdit:
type: object
properties:
name:
type: string
description: Name of the user
example: Jack Daniels
maxLength: 200
age:
type: integer
description: Age of user
minimum: 0
maximum: 150
User:
type: object
additionalProperties: false
allOf:
- type: object
required:
- id
- createdAt
- updatedAt
properties:
id:
$ref: '#/components/schemas/UserID'
createdAt:
$ref: '#/components/schemas/Timestamp'
updatedAt:
$ref: '#/components/schemas/Timestamp'
- $ref: '#/components/schemas/UserCreate'
Timestamp:
type: string
format: date-time
description: An ISO formatted Timestamp
UserID:
type: string
description: Unique identifier for a user
minLength: 8
maxLength: 64
securitySchemes:
token:
type: http
scheme: bearer
bearerFormat: JWT