rob-revisited/ide/tests/fixtures/http-client/openapi.json

34 lines
2.2 KiB
JSON

{
"openapi": "3.1.0",
"info": {"title": "Library", "version": "1.0"},
"servers": [{"url": "/"}],
"tags": [{"name": "Book", "description": "The books"}],
"paths": {
"/api/books": {
"get": {"tags": ["Book"], "summary": "Lists the books", "operationId": "listBooks",
"parameters": [{"name": "page", "in": "query", "required": true, "schema": {"type": "integer", "default": 1}},
{"name": "title", "in": "query", "schema": {"type": "string"}}],
"responses": {"200": {"description": "Books", "content": {"application/ld+json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Book"}}}}}}},
"post": {"tags": ["Book"], "summary": "Creates a book", "security": [{"JWT": []}],
"requestBody": {"required": true, "content": {"application/ld+json": {"schema": {"$ref": "#/components/schemas/Book"}}}},
"responses": {"201": {"description": "Created", "content": {"application/ld+json": {"schema": {"$ref": "#/components/schemas/Book"}}}}, "422": {"description": "Invalid"}}}
},
"/api/books/{id}": {
"parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "integer"}, "example": 42}],
"get": {"tags": ["Book"], "summary": "Gets a book", "responses": {"200": {"description": "A book"}}},
"delete": {"summary": "Deletes a book", "security": [{"Key": []}], "responses": {"204": {"description": "Deleted"}}}
}
},
"components": {
"schemas": {
"Book": {"type": "object", "required": ["title"], "properties": {
"id": {"type": "integer", "readOnly": true},
"title": {"type": "string", "example": "Dune"},
"published": {"type": "string", "format": "date-time"},
"author": {"$ref": "#/components/schemas/Author"}}},
"Author": {"allOf": [{"$ref": "#/components/schemas/Person"}, {"type": "object", "properties": {"books": {"type": "array", "items": {"$ref": "#/components/schemas/Book"}}}}]},
"Person": {"type": "object", "properties": {"name": {"type": "string"}, "email": {"type": "string", "format": "email"}}}
},
"securitySchemes": {"JWT": {"type": "http", "scheme": "bearer", "bearerFormat": "JWT"}, "Key": {"type": "apiKey", "in": "header", "name": "X-API-Key"}}
}
}