-
Notifications
You must be signed in to change notification settings - Fork 11
/
openapi.yaml
229 lines (221 loc) · 6.56 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
openapi: 3.0.0
info:
version: v1
title: FarmtStall API
# servers:
# - url: 'https://farmstall.designapis.com/v1'
# - url: 'http://localhost:8080/v1'
paths:
/reviews:
get:
description: Get a list of reviews
parameters:
- name: maxRating
in: query
schema:
type: number
responses:
'200':
description: A bunch of reviews
content:
application/json:
schema:
type: array
items:
type: object
properties:
rating:
type: integer
minimum: 1
maximum: 5
message:
type: string
uuid:
type: string
pattern: '^[0-9a-fA-F\-]{36}$'
userId:
type: string
pattern: '^[0-9a-fA-F\-]{36}$'
nullable: true
post:
description: Create a new Review
security:
- Token: []
- {}
requestBody:
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: An awesome time for the whole family.
rating:
type: integer
minimum: 1
maximum: 5
example: 5
responses:
'201':
description: Successfully created a new Review
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: An awesome time for the whole family.
rating:
type: integer
minimum: 1
maximum: 5
example: 5
userId:
type: string
nullable: true
pattern: '[a-zA-Z-.0-9]{36}'
example: f7f680a8-d111-421f-b6b3-493ebf905078
uuid:
type: string
pattern: '[a-zA-Z-.0-9]{36}'
example: f7f680a8-d111-421f-b6b3-493ebf905078
/reviews/{reviewId}:
get:
description: Get a single review
security:
- Token: []
- {}
parameters:
- name: reviewId
in: path
required: true
schema:
type: string
minLength: 36
maxLength: 36
pattern: '[a-zA-Z0-9-]+'
responses:
'200':
description: A single review
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: An awesome time for the whole family.
rating:
type: integer
minimum: 1
maximum: 5
example: 5
userId:
minLength: 36
maxLength: 36
pattern: '^[a-zA-Z0-9-]+$'
nullable: true
example: f7f680a8-d111-421f-b6b3-493ebf905078
uuid:
minLength: 36
maxLength: 36
pattern: '^[a-zA-Z0-9-]+$'
example: f7f680a8-d111-421f-b6b3-493ebf905078
'404':
description: Review not found
/users:
post:
description: Create a new user
requestBody:
description: User details
content:
application/json:
schema:
type: object
properties:
username:
type: string
example: ponelat
password:
type: string
format: password
fullName:
type: string
example: Josh Ponelat
responses:
'201':
description: Successfully created a new user
content:
application/json:
schema:
type: object
properties:
username:
type: string
example: ponelat
uuid:
type: string
example: f7f680a8-d111-421f-b6b3-493ebf905078
'400':
description: Invalid request body
content:
application/json:
schema:
type: object
properties:
type:
type: string
example: https://farmstall.designapis.com/probs/invalid-body
title:
type: string
example: Request body failed validation
invalid-fields:
type: array
items:
type: object
properties:
path:
type: string
example: '#/message'
description: A path representing the field, from the root of the document
expected:
type: string
description: Human readble message describing what the expected value of the field was
example: must be a string
actual:
type: string
description: The actual value that was received by the server
example: '12'
/tokens:
post:
description: Create a new token
requestBody:
content:
application/json:
schema:
type: object
properties:
username:
type: string
example: ponelat
password:
type: string
format: password
responses:
'201':
description: Create a new token for gaining authenticated access to resources
content:
application/json:
schema:
type: object
properties:
token:
type: string
components:
securitySchemes:
Token:
name: Authorization
type: apiKey
in: header