| 1 | { |
| 2 | "openapi": "3.0.0", |
| 3 | "servers": [ |
| 4 | { |
| 5 | "url": "https://generated-bookstore.appspot.com/" |
| 6 | } |
| 7 | ], |
| 8 | "info": { |
| 9 | "description": "A simple Bookstore API example.", |
| 10 | "title": "Bookstore", |
| 11 | "version": "1.0.0" |
| 12 | }, |
| 13 | "paths": { |
| 14 | "/shelves": { |
| 15 | "get": { |
| 16 | "description": "Return all shelves in the bookstore.", |
| 17 | "operationId": "listShelves", |
| 18 | "responses": { |
| 19 | "200": { |
| 20 | "description": "List of shelves in the bookstore.", |
| 21 | "content": { |
| 22 | "application/json": { |
| 23 | "schema": { |
| 24 | "$ref": "#/components/schemas/listShelvesResponse" |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | }, |
| 30 | "security": [] |
| 31 | }, |
| 32 | "post": { |
| 33 | "description": "Create a new shelf in the bookstore.", |
| 34 | "operationId": "createShelf", |
| 35 | "responses": { |
| 36 | "200": { |
| 37 | "description": "A newly created shelf resource.", |
| 38 | "content": { |
| 39 | "application/json": { |
| 40 | "schema": { |
| 41 | "$ref": "#/components/schemas/shelf" |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | }, |
| 47 | "requestBody": { |
| 48 | "content": { |
| 49 | "application/json": { |
| 50 | "schema": { |
| 51 | "$ref": "#/components/schemas/shelf" |
| 52 | } |
| 53 | } |
| 54 | }, |
| 55 | "description": "A shelf resource to create.", |
| 56 | "required": true |
| 57 | } |
| 58 | }, |
| 59 | "delete": { |
| 60 | "description": "Delete all shelves.", |
| 61 | "operationId": "deleteShelves", |
| 62 | "responses": { |
| 63 | "default": { |
| 64 | "description": "An empty response body." |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | }, |
| 69 | "/shelves/{shelf}": { |
| 70 | "get": { |
| 71 | "description": "Get a single shelf resource with the given ID.", |
| 72 | "operationId": "getShelf", |
| 73 | "parameters": [ |
| 74 | { |
| 75 | "description": "ID of the shelf to get.", |
| 76 | "in": "path", |
| 77 | "name": "shelf", |
| 78 | "required": true, |
| 79 | "schema": { |
| 80 | "type": "integer", |
| 81 | "format": "int64" |
| 82 | } |
| 83 | } |
| 84 | ], |
| 85 | "responses": { |
| 86 | "200": { |
| 87 | "description": "A shelf resource.", |
| 88 | "content": { |
| 89 | "application/json": { |
| 90 | "schema": { |
| 91 | "$ref": "#/components/schemas/shelf" |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | }, |
| 96 | "default": { |
| 97 | "description": "unexpected error", |
| 98 | "content": { |
| 99 | "application/json": { |
| 100 | "schema": { |
| 101 | "$ref": "#/components/schemas/error" |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | }, |
| 108 | "delete": { |
| 109 | "description": "Delete a single shelf with the given ID.", |
| 110 | "operationId": "deleteShelf", |
| 111 | "parameters": [ |
| 112 | { |
| 113 | "description": "ID of the shelf to delete.", |
| 114 | "in": "path", |
| 115 | "name": "shelf", |
| 116 | "required": true, |
| 117 | "schema": { |
| 118 | "type": "integer", |
| 119 | "format": "int64" |
| 120 | } |
| 121 | } |
| 122 | ], |
| 123 | "responses": { |
| 124 | "default": { |
| 125 | "description": "An empty response body." |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | }, |
| 130 | "/shelves/{shelf}/books": { |
| 131 | "get": { |
| 132 | "description": "Return all books in a shelf with the given ID.", |
| 133 | "operationId": "listBooks", |
| 134 | "parameters": [ |
| 135 | { |
| 136 | "description": "ID of the shelf whose books should be returned.", |
| 137 | "in": "path", |
| 138 | "name": "shelf", |
| 139 | "required": true, |
| 140 | "schema": { |
| 141 | "type": "integer", |
| 142 | "format": "int64" |
| 143 | } |
| 144 | } |
| 145 | ], |
| 146 | "responses": { |
| 147 | "200": { |
| 148 | "description": "List of books on the specified shelf.", |
| 149 | "content": { |
| 150 | "application/json": { |
| 151 | "schema": { |
| 152 | "$ref": "#/components/schemas/listBooksResponse" |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | }, |
| 157 | "default": { |
| 158 | "description": "unexpected error", |
| 159 | "content": { |
| 160 | "application/json": { |
| 161 | "schema": { |
| 162 | "$ref": "#/components/schemas/error" |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | }, |
| 169 | "post": { |
| 170 | "description": "Create a new book on the shelf.", |
| 171 | "operationId": "createBook", |
| 172 | "parameters": [ |
| 173 | { |
| 174 | "description": "ID of the shelf where the book should be created.", |
| 175 | "in": "path", |
| 176 | "name": "shelf", |
| 177 | "required": true, |
| 178 | "schema": { |
| 179 | "type": "integer", |
| 180 | "format": "int64" |
| 181 | } |
| 182 | } |
| 183 | ], |
| 184 | "responses": { |
| 185 | "200": { |
| 186 | "description": "A newly created book resource.", |
| 187 | "content": { |
| 188 | "application/json": { |
| 189 | "schema": { |
| 190 | "$ref": "#/components/schemas/book" |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | }, |
| 195 | "default": { |
| 196 | "description": "unexpected error", |
| 197 | "content": { |
| 198 | "application/json": { |
| 199 | "schema": { |
| 200 | "$ref": "#/components/schemas/error" |
| 201 | } |
| 202 | } |
| 203 | } |
| 204 | } |
| 205 | }, |
| 206 | "requestBody": { |
| 207 | "content": { |
| 208 | "application/json": { |
| 209 | "schema": { |
| 210 | "$ref": "#/components/schemas/book" |
| 211 | } |
| 212 | } |
| 213 | }, |
| 214 | "description": "Book to create.", |
| 215 | "required": true |
| 216 | } |
| 217 | } |
| 218 | }, |
| 219 | "/shelves/{shelf}/books/{book}": { |
| 220 | "get": { |
| 221 | "description": "Get a single book with a given ID from a shelf.", |
| 222 | "operationId": "getBook", |
| 223 | "parameters": [ |
| 224 | { |
| 225 | "description": "ID of the shelf from which to get the book.", |
| 226 | "in": "path", |
| 227 | "name": "shelf", |
| 228 | "required": true, |
| 229 | "schema": { |
| 230 | "type": "integer", |
| 231 | "format": "int64" |
| 232 | } |
| 233 | }, |
| 234 | { |
| 235 | "description": "ID of the book to get from the shelf.", |
| 236 | "in": "path", |
| 237 | "name": "book", |
| 238 | "required": true, |
| 239 | "schema": { |
| 240 | "type": "integer", |
| 241 | "format": "int64" |
| 242 | } |
| 243 | } |
| 244 | ], |
| 245 | "responses": { |
| 246 | "200": { |
| 247 | "description": "A book resource.", |
| 248 | "content": { |
| 249 | "application/json": { |
| 250 | "schema": { |
| 251 | "$ref": "#/components/schemas/book" |
| 252 | } |
| 253 | } |
| 254 | } |
| 255 | }, |
| 256 | "default": { |
| 257 | "description": "unexpected error", |
| 258 | "content": { |
| 259 | "application/json": { |
| 260 | "schema": { |
| 261 | "$ref": "#/components/schemas/error" |
| 262 | } |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | }, |
| 268 | "delete": { |
| 269 | "description": "Delete a single book with a given ID from a shelf.", |
| 270 | "operationId": "deleteBook", |
| 271 | "parameters": [ |
| 272 | { |
| 273 | "description": "ID of the shelf from which to delete the book.", |
| 274 | "in": "path", |
| 275 | "name": "shelf", |
| 276 | "required": true, |
| 277 | "schema": { |
| 278 | "type": "integer", |
| 279 | "format": "int64" |
| 280 | } |
| 281 | }, |
| 282 | { |
| 283 | "description": "ID of the book to delete from the shelf.", |
| 284 | "in": "path", |
| 285 | "name": "book", |
| 286 | "required": true, |
| 287 | "schema": { |
| 288 | "type": "integer", |
| 289 | "format": "int64" |
| 290 | } |
| 291 | } |
| 292 | ], |
| 293 | "responses": { |
| 294 | "default": { |
| 295 | "description": "An empty response body." |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | } |
| 300 | }, |
| 301 | "security": [ |
| 302 | { |
| 303 | "api_key": [] |
| 304 | } |
| 305 | ], |
| 306 | "components": { |
| 307 | "schemas": { |
| 308 | "book": { |
| 309 | "properties": { |
| 310 | "author": { |
| 311 | "type": "string" |
| 312 | }, |
| 313 | "name": { |
| 314 | "type": "string" |
| 315 | }, |
| 316 | "title": { |
| 317 | "type": "string" |
| 318 | } |
| 319 | }, |
| 320 | "required": [ |
| 321 | "name", |
| 322 | "author", |
| 323 | "title" |
| 324 | ], |
| 325 | "type": "object" |
| 326 | }, |
| 327 | "listBooksResponse": { |
| 328 | "properties": { |
| 329 | "books": { |
| 330 | "items": { |
| 331 | "$ref": "#/components/schemas/book" |
| 332 | }, |
| 333 | "type": "array" |
| 334 | } |
| 335 | }, |
| 336 | "required": [ |
| 337 | "books" |
| 338 | ], |
| 339 | "type": "object" |
| 340 | }, |
| 341 | "listShelvesResponse": { |
| 342 | "properties": { |
| 343 | "shelves": { |
| 344 | "items": { |
| 345 | "$ref": "#/components/schemas/shelf" |
| 346 | }, |
| 347 | "type": "array" |
| 348 | } |
| 349 | }, |
| 350 | "type": "object" |
| 351 | }, |
| 352 | "shelf": { |
| 353 | "properties": { |
| 354 | "name": { |
| 355 | "type": "string" |
| 356 | }, |
| 357 | "theme": { |
| 358 | "type": "string" |
| 359 | } |
| 360 | }, |
| 361 | "required": [ |
| 362 | "name", |
| 363 | "theme" |
| 364 | ], |
| 365 | "type": "object" |
| 366 | }, |
| 367 | "error": { |
| 368 | "required": [ |
| 369 | "code", |
| 370 | "message" |
| 371 | ], |
| 372 | "properties": { |
| 373 | "code": { |
| 374 | "type": "integer", |
| 375 | "format": "int32" |
| 376 | }, |
| 377 | "message": { |
| 378 | "type": "string" |
| 379 | } |
| 380 | }, |
| 381 | "type": "object" |
| 382 | } |
| 383 | }, |
| 384 | "securitySchemes": { |
| 385 | "api_key": { |
| 386 | "in": "query", |
| 387 | "name": "key", |
| 388 | "type": "apiKey" |
| 389 | } |
| 390 | } |
| 391 | } |
| 392 | } |