-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
executable file
·331 lines (330 loc) · 8 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
openapi: 3.0.1
info:
title: Cookshelf API
description: 'This is the API documentation for the Cookshelf recipes app'
termsOfService: https://github.com/RobYed
contact:
email: [email protected]
license:
name: MIT
url: https://github.com/RobYed/cookshelf-app/blob/master/LICENSE
version: 1.0.0
externalDocs:
description: Find out more about Cookshelf
url: https://cookshelf.com
servers:
- url: https://cookshelf.com/api/v1
tags:
- name: recipe
description: A generic description of a single recipe
externalDocs:
description: Find out more
url: https://cookshelf.com
paths:
/recipe:
put:
tags:
- recipe
summary: Update an existing recipe
operationId: updateRecipe
requestBody:
description: Recipe object that needs to be added to the cookshelf
content:
application/json:
schema:
$ref: '#/components/schemas/Recipe'
required: true
responses:
200:
description: Recipe successfully updated
content:
application/json:
schema:
$ref: '#/components/schemas/Recipe'
400:
description: Invalid ID supplied
content: {}
404:
description: Recipe not found
content: {}
405:
description: Invalid input
content: {}
security:
- cookshelf_auth:
- write:recipes
- read:recipes
x-codegen-request-body-name: body
post:
tags:
- recipe
summary: Add a new recipe to the cookshelf
operationId: createRecipe
requestBody:
description: Recipe object that needs to be added to the cookshelf
content:
application/json:
schema:
$ref: '#/components/schemas/Recipe'
required: true
responses:
201:
description: Recipe successfully created
content:
application/json:
schema:
$ref: '#/components/schemas/Recipe'
405:
description: Invalid input
content: {}
security:
- cookshelf_auth:
- write:recipes
- read:recipes
x-codegen-request-body-name: body
get:
tags:
- recipe
summary: Get a list of recipes
description: Filter by name or tags
operationId: getRecipes
parameters:
- name: name
in: query
description: Name to filter by
required: false
schema:
type: string
- name: tags
in: query
description: Tags to filter by
required: false
explode: true
schema:
type: array
items:
type: string
responses:
200:
description: recipes found
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Recipe'
204:
description: no recipe found
content:
application/json:
schema:
type: array
description: empty array
items:
$ref: '#/components/schemas/Recipe'
400:
description: Invalid tag or name value
content: {}
security:
- cookshelf_auth:
- read:recipes
/recipe/{recipeId}:
get:
tags:
- recipe
summary: Find recipe by ID
description: Returns a single recipe
operationId: getRecipeById
parameters:
- name: recipeId
in: path
description: ID of recipe to return
required: true
schema:
type: integer
format: int64
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Recipe'
404:
description: Recipe not found
content: {}
security:
- api_key: []
delete:
tags:
- recipe
summary: Deletes a recipe
operationId: deleteRecipe
parameters:
- name: recipeId
in: path
description: Recipe id to delete
required: true
schema:
type: integer
format: int64
responses:
204:
description: recipe successfully DELETED
404:
description: Recipe not found
content: {}
security:
- cookshelf_auth:
- write:recipes
- read:recipes
/recipe/{recipeId}/image:
post:
tags:
- recipe
summary: Saves an image to a specific recipe
operationId: saveImage
parameters:
- name: recipeId
in: path
description: ID of recipe to update
required: true
schema:
type: integer
format: int64
requestBody:
content:
multipart/form-data:
schema:
properties:
additionalMetadata:
type: string
description: Additional data to pass to server
file:
type: string
description: file to upload
format: binary
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
security:
- cookshelf_auth:
- write:recipes
- read:recipes
components:
schemas:
UnitOfMeasurement:
required:
- name
type: object
properties:
id:
type: integer
format: int64
name:
type: string
example: gram
Ingredient:
required:
- name
type: object
properties:
id:
type: integer
format: int64
amount:
type: number
format: float
example: 250
unit:
$ref: '#/components/schemas/UnitOfMeasurement'
name:
type: string
example: spaghetti
Tag:
required:
- name
type: object
properties:
id:
type: integer
format: int64
name:
type: string
example: vegetarian
Recipe:
required:
- name
- ingredients
- instructions
- status
type: object
properties:
id:
type: integer
format: int64
name:
type: string
example: Spaghetti Carbonara
description:
type: string
example: Best Carbonara in the world
ingredients:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Ingredient'
instructions:
type: array
minItems: 1
items:
type: string
imageUrls:
type: array
items:
type: string
tags:
type: array
uniqueItems: true
items:
$ref: '#/components/schemas/Tag'
note:
type: string
example: You might also try linguins instead of spaghetti
status:
type: string
description: recipe status in the cookshelf
enum:
- DRAFT
- FINAL
- DELETED
originalSource:
type: string
description: where the recipe was originally taken from (e.g. URL, ISBN, name)
ApiResponse:
type: object
properties:
code:
type: integer
format: int32
type:
type: string
message:
type: string
securitySchemes:
cookshelf_auth:
type: oauth2
flows:
implicit:
authorizationUrl: http://petstore.swagger.io/oauth/dialog
scopes:
write:pets: modify recipes in your account
read:pets: read your recipes
api_key:
type: apiKey
name: api_key
in: header