-
Notifications
You must be signed in to change notification settings - Fork 139
/
Copy pathfruitshop-api.yml
270 lines (260 loc) · 6.71 KB
/
fruitshop-api.yml
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
openapi: '3.0.2'
info:
title: Fruit Shop API
version: '2.0'
x-membrane-id: fruitshop
servers:
- url: https://api.predic8.de/shop/v2
paths:
/products:
get:
tags:
- Products
summary: Get all products
description: Get a list of all the products available over the Fruitshop API.
operationId: getProducts
parameters:
- $ref: "#/components/parameters/Start"
- $ref: "#/components/parameters/Limit"
- name: search
in: query
description: Search for products containing this String
schema:
type: string
responses:
'200':
$ref: "#/components/responses/Products"
post:
tags:
- Products
summary: Create a product
description: Create a new product for the store.
operationId: createProduct
requestBody:
$ref: "#/components/requestBodies/Product"
responses:
'201':
$ref: "#/components/responses/ProductCreated"
/products/{id}:
parameters:
- $ref: "#/components/parameters/Id"
get:
tags:
- Products
summary: Get product by id
description: Get detailed information about the product.
operationId: getProduct
responses:
'200':
$ref: "#/components/responses/Product"
components:
parameters:
Id:
name: id
in: path
description: Id of the object
required: true
schema:
$ref: "#/components/schemas/Id"
Start:
name: start
in: query
description: Starting entry of the result list
schema:
type: number
minimum: 1
default: 1
example: 7
Limit:
name: limit
in: query
description: Limits the number of result entries
schema:
minimum: 1
type: number
default: 10
example: 100
responses:
Product:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Product"
example:
id: 8
name: Mangos,
price: 2.79
Products:
description: OK
content:
application/json:
schema:
type: object
properties:
meta:
$ref: "#/components/schemas/Meta"
products:
type: array
items:
type: object
properties:
id:
$ref: "#/components/schemas/Id"
name:
type: string
description: Name of the product
example: Cherries
self_link:
$ref: "#/components/schemas/SelfLink"
example:
id: 1
name: Banana
self_link: /shop/v2/products/1
ProductCreated:
description: Created
headers:
location:
schema:
type: string
format: uri
content:
application/json:
schema:
$ref: "#/components/schemas/Product"
example:
id: 8
name: Mangos,
price: 2.79
self_link: /shop/v2/products/8
requestBodies:
Product:
content:
application/json:
schema:
$ref: '#/components/schemas/Product'
example:
name: Mangos
price: 2.79
Products:
description: OK
content:
application/json:
schema:
type: object
properties:
meta:
$ref: "#/components/schemas/Meta"
products:
type: array
items:
type: object
properties:
id:
$ref: "#/components/schemas/Id"
name:
type: string
description: Name of the product
example: Cherries
self_link:
$ref: "#/components/schemas/SelfLink"
example:
id: 1
name: Banana
self_link: /shop/v2/products/1
schemas:
ProductList:
type: object
properties:
meta:
type: object
products:
type: array
items:
type: object
properties:
name:
type: string
product_url:
type: string
SelfLink:
type: string
format: url
readOnly: true
example: /shop/v2/...
description: Link to the resource itself
Meta:
required:
- count
type: object
properties:
count:
type: integer
description: Number of resources
example: 22
start:
type: integer
description: Starting entry of the result list
example: 11
limit:
type: integer
description: How many entries are delivered in one response
example: 10
previous_link:
type: string
description: URL to the previous page of results
example: /shop/v2/products/?start=1&limit=10
next_link:
type: string
description: URL to the next page of results
example: /shop/v2/products/?start=21&limit=10
description: Metadata about a collection of resources.
Product:
type: object
description: Description of a product
required:
- name
- price
properties:
id:
$ref: "#/components/schemas/Id"
name:
type: string
description: Name of a product
example: Berries
maxLength: 30
price:
type: number
description: Price of a good
example: 4.5
minimum: 0
maximum: 1000
vendors:
type: array
readOnly: true
items:
type: object
properties:
id:
$ref: "#/components/schemas/Id"
name:
type: string
description: Name of the vendor
example: Exotic Fruits LLC
maxLength: 30
self_link:
$ref: "#/components/schemas/SelfLink"
image_link:
type: string
readOnly: true
self_link:
$ref: "#/components/schemas/SelfLink"
example:
name: Wildberries
price: 4.99
Id:
type: integer
description: Id of an object
example: 8
minimum: 1
readOnly: true