{"openapi":"3.0.3","info":{"title":"Books API","version":"1.1.0","description":"A small CRUD API for Voiden demos. Reads are open; writes need the `x-api-key` header."},"servers":[{"url":"https://voiden-demo.apyverse.dev"}],"tags":[{"name":"Books"},{"name":"Service"}],"paths":{"/health":{"get":{"tags":["Service"],"summary":"Health check","operationId":"getHealth","responses":{"200":{"description":"Service is up","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}}}},"/reset":{"post":{"tags":["Service"],"summary":"Restore the seeded books","operationId":"resetBooks","security":[{"apiKey":[]}],"responses":{"200":{"description":"Data was reset"},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/books":{"get":{"tags":["Books"],"summary":"List books","operationId":"listBooks","parameters":[{"name":"author","in":"query","schema":{"type":"string"},"description":"Substring match on the author"},{"name":"q","in":"query","schema":{"type":"string"},"description":"Substring match on title or author"},{"name":"inStock","in":"query","schema":{"type":"boolean"}},{"name":"sort","in":"query","schema":{"type":"string","enum":["title","-title","author","-author","price","-price","createdAt","-createdAt"]}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":100}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"A page of books","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookList"}}}},"400":{"description":"Invalid query parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Books"],"summary":"Create a book","operationId":"createBook","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookInput"},"example":{"title":"Voiden in Action","author":"Ada Lovelace","price":29.99,"inStock":true}}}},"responses":{"201":{"description":"The created book","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Book"}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/books/{id}":{"get":{"tags":["Books"],"summary":"Get a book","operationId":"getBook","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"1"}],"responses":{"200":{"description":"The book","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Book"}}}},"404":{"description":"Book not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["Books"],"summary":"Replace a book","operationId":"replaceBook","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"1"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookInput"},"example":{"title":"Voiden in Action","author":"Ada Lovelace","price":29.99,"inStock":true}}}},"responses":{"200":{"description":"The updated book","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Book"}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Book not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["Books"],"summary":"Update some fields of a book","operationId":"updateBook","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"1"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookPatch"},"example":{"price":24.99}}}},"responses":{"200":{"description":"The updated book","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Book"}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Book not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Books"],"summary":"Delete a book","operationId":"deleteBook","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"1"}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Book not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"Book":{"type":"object","required":["id","title","author","price","inStock","createdAt","updatedAt"],"properties":{"id":{"type":"string","example":"100"},"title":{"type":"string"},"author":{"type":"string"},"price":{"type":"number","minimum":0},"inStock":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"BookInput":{"type":"object","required":["title","author"],"properties":{"title":{"type":"string","maxLength":200},"author":{"type":"string","maxLength":200},"price":{"type":"number","minimum":0,"default":0},"inStock":{"type":"boolean","default":true}}},"BookPatch":{"type":"object","minProperties":1,"properties":{"title":{"type":"string","maxLength":200},"author":{"type":"string","maxLength":200},"price":{"type":"number","minimum":0},"inStock":{"type":"boolean"}}},"BookList":{"type":"object","required":["items","total","limit","offset"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Book"}},"total":{"type":"integer","description":"Number of books matching the filters"},"limit":{"type":"integer"},"offset":{"type":"integer"}}},"Health":{"type":"object","properties":{"status":{"type":"string","example":"ok"},"version":{"type":"string"},"books":{"type":"integer"},"uptimeSeconds":{"type":"integer"}}},"Error":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","example":"Book not found"},"code":{"type":"string","example":"not_found"},"details":{"type":"array","items":{"type":"string"}}}}}}}