-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yaml
248 lines (246 loc) · 6.18 KB
/
swagger.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
swagger: "2.0"
info:
description: "This is the API of the Istio BookInfo sample application."
version: "1.0.0"
title: "BookInfo API"
termsOfService: "https://istio.io/"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
basePath: "/api/v1"
tags:
- name: "product"
description: "Information about a product (in this case a book)"
- name: "review"
description: "Review information for a product"
- name: "rating"
description: "Rating information for a product"
externalDocs:
description: "Learn more about the Istio BookInfo application"
url: "https://istio.io/docs/samples/bookinfo.html"
paths:
/products:
get:
tags:
- "product"
summary: "List all products"
description: "List all products available in the application with a minimum amount of information."
operationId: "getProducts"
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/Product"
/products/{id}:
get:
tags:
- "product"
summary: "Get individual product"
description: "Get detailed information about an individual product with the given id."
operationId: "getProduct"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "id"
in: "path"
description: "Product id"
required: true
type: "integer"
format: "int32"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/ProductDetails"
400:
description: "Invalid product id"
/products/{id}/reviews:
get:
tags:
- "review"
summary: "Get reviews for a product"
description: "Get reviews for a product, including review text and possibly ratings information."
operationId: "getProductReviews"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "id"
in: "path"
description: "Product id"
required: true
type: "integer"
format: "int32"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/ProductReviews"
400:
description: "Invalid product id"
/products/{id}/ratings:
get:
tags:
- "rating"
summary: "Get ratings for a product"
description: "Get ratings for a product, including stars and their color."
operationId: "getProductRatings"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "id"
in: "path"
description: "Product id"
required: true
type: "integer"
format: "int32"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/ProductRatings"
400:
description: "Invalid product id"
definitions:
Product:
type: "object"
description: "Basic information about a product"
properties:
id:
type: "integer"
format: "int32"
description: "Product id"
title:
type: "string"
description: "Title of the book"
descriptionHtml:
type: "string"
description: "Description of the book - may contain HTML tags"
required:
- "id"
- "title"
- "descriptionHtml"
ProductDetails:
type: "object"
description: "Detailed information about a product"
properties:
id:
type: "integer"
format: "int32"
description: "Product id"
publisher:
type: "string"
description: "Publisher of the book"
language:
type: "string"
description: "Language of the book"
author:
type: "string"
description: "Author of the book"
ISBN-10:
type: "string"
description: "ISBN-10 of the book"
ISBN-13:
type: "string"
description: "ISBN-13 of the book"
year:
type: "integer"
format: "int32"
description: "Year the book was first published in"
type:
type: "string"
enum:
- "paperback"
- "hardcover"
description: "Type of the book"
pages:
type: "integer"
format: "int32"
description: "Number of pages of the book"
required:
- "id"
- "publisher"
- "language"
- "author"
- "ISBN-10"
- "ISBN-13"
- "year"
- "type"
- "pages"
ProductReviews:
type: "object"
description: "Object containing reviews for a product"
properties:
id:
type: "integer"
format: "int32"
description: "Product id"
reviews:
type: "array"
description: "List of reviews"
items:
$ref: "#/definitions/Review"
required:
- "id"
- "reviews"
Review:
type: "object"
description: "Review of a product"
properties:
reviewer:
type: "string"
description: "Name of the reviewer"
text:
type: "string"
description: "Review text"
rating:
$ref: "#/definitions/Rating"
required:
- "reviewer"
- "text"
Rating:
type: "object"
description: "Rating of a product"
properties:
stars:
type: "integer"
format: "int32"
minimum: 1
maximum: 5
description: "Number of stars"
color:
type: "string"
enum:
- "red"
- "black"
description: "Color in which stars should be displayed"
required:
- "stars"
- "color"
ProductRatings:
type: "object"
description: "Object containing ratings of a product"
properties:
id:
type: "integer"
format: "int32"
description: "Product id"
ratings:
type: "object"
description: "A hashmap where keys are reviewer names, values are number of stars"
additionalProperties:
type: "string"
required:
- "id"
- "ratings"