forked from solo-io/workshops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.json
283 lines (283 loc) · 7.98 KB
/
swagger.json
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
{
"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"
} ],
"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" ],
"parameters" : [ ],
"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",
"required" : [ "descriptionHtml", "id", "title" ],
"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"
}
},
"description" : "Basic information about a product"
},
"ProductDetails" : {
"type" : "object",
"required" : [ "ISBN-10", "ISBN-13", "author", "id", "language", "pages", "publisher", "type", "year" ],
"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",
"description" : "Type of the book",
"enum" : [ "paperback", "hardcover" ]
},
"pages" : {
"type" : "integer",
"format" : "int32",
"description" : "Number of pages of the book"
}
},
"description" : "Detailed information about a product"
},
"ProductReviews" : {
"type" : "object",
"required" : [ "id", "reviews" ],
"properties" : {
"id" : {
"type" : "integer",
"format" : "int32",
"description" : "Product id"
},
"reviews" : {
"type" : "array",
"description" : "List of reviews",
"items" : {
"$ref" : "#/definitions/Review"
}
}
},
"description" : "Object containing reviews for a product"
},
"Review" : {
"type" : "object",
"required" : [ "reviewer", "text" ],
"properties" : {
"reviewer" : {
"type" : "string",
"description" : "Name of the reviewer"
},
"text" : {
"type" : "string",
"description" : "Review text"
},
"rating" : {
"$ref" : "#/definitions/Rating"
}
},
"description" : "Review of a product"
},
"Rating" : {
"type" : "object",
"required" : [ "color", "stars" ],
"properties" : {
"stars" : {
"type" : "integer",
"format" : "int32",
"description" : "Number of stars",
"minimum" : 1,
"maximum" : 5
},
"color" : {
"type" : "string",
"description" : "Color in which stars should be displayed",
"enum" : [ "red", "black" ]
}
},
"description" : "Rating of a product"
},
"ProductRatings" : {
"type" : "object",
"required" : [ "id", "ratings" ],
"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"
}
}
},
"description" : "Object containing ratings of a product"
}
},
"externalDocs" : {
"description" : "Learn more about the Istio BookInfo application",
"url" : "https://istio.io/docs/samples/bookinfo.html"
}
}