{"openapi":"3.1.0","info":{"title":"Virtual Library API","description":"REST API for virtual library management with semantic search.","version":"1.0.0"},"paths":{"/health":{"get":{"tags":["health"],"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/books/search/semantic":{"get":{"tags":["search"],"summary":"Semantic search over book embeddings","description":"Ranks all indexed books by cosine similarity to the query. Skips books without embeddings (created while AI features were off).","operationId":"semantic_search_books_search_semantic_get","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"Free-text query","title":"Q"},"description":"Free-text query"},{"name":"top_k","in":"query","required":false,"schema":{"type":"integer","maximum":20,"minimum":1,"default":5,"title":"Top K"}},{"name":"min_score","in":"query","required":false,"schema":{"type":"number","maximum":1.0,"minimum":-1.0,"default":0.0,"title":"Min Score"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SemanticSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/books":{"post":{"tags":["books"],"summary":"Create a new book","operationId":"create_book_books_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["books"],"summary":"List books with optional filters, pagination and ordering","operationId":"list_books_books_get","parameters":[{"name":"title","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive partial match on title","title":"Title"},"description":"Case-insensitive partial match on title"},{"name":"author","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Case-insensitive partial match on author","title":"Author"},"description":"Case-insensitive partial match on author"},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","maximum":1000000,"minimum":0,"default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"sort_by","in":"query","required":false,"schema":{"enum":["title","author","published_date","created_at"],"type":"string","default":"created_at","title":"Sort By"}},{"name":"order","in":"query","required":false,"schema":{"enum":["asc","desc"],"type":"string","default":"desc","title":"Order"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/books/{book_id}":{"get":{"tags":["books"],"summary":"Get a book by ID","operationId":"get_book_books__book_id__get","parameters":[{"name":"book_id","in":"path","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"minimum":1,"title":"Book Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookRead"}}}},"404":{"description":"Book not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["books"],"summary":"Update a book (partial)","operationId":"update_book_books__book_id__put","parameters":[{"name":"book_id","in":"path","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"minimum":1,"title":"Book Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookRead"}}}},"404":{"description":"Book not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["books"],"summary":"Delete a book","operationId":"delete_book_books__book_id__delete","parameters":[{"name":"book_id","in":"path","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"minimum":1,"title":"Book Id"}}],"responses":{"204":{"description":"Successful Response"},"404":{"description":"Book not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"BookCreate":{"properties":{"title":{"type":"string","maxLength":500,"minLength":1,"title":"Title"},"author":{"type":"string","maxLength":200,"minLength":1,"title":"Author"},"published_date":{"type":"string","format":"date","title":"Published Date"},"summary":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Summary"}},"type":"object","required":["title","author","published_date"],"title":"BookCreate"},"BookList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/BookRead"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"skip":{"type":"integer","title":"Skip"},"limit":{"type":"integer","title":"Limit"}},"type":"object","required":["items","total","skip","limit"],"title":"BookList"},"BookRead":{"properties":{"title":{"type":"string","maxLength":500,"minLength":1,"title":"Title"},"author":{"type":"string","maxLength":200,"minLength":1,"title":"Author"},"published_date":{"type":"string","format":"date","title":"Published Date"},"summary":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Summary"},"id":{"type":"integer","title":"Id"},"summary_source":{"$ref":"#/components/schemas/SummarySource"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["title","author","published_date","id","summary_source","created_at","updated_at"],"title":"BookRead"},"BookUpdate":{"properties":{"title":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"null"}],"title":"Title"},"author":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Author"},"published_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Published Date"},"summary":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Summary"}},"type":"object","title":"BookUpdate"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthResponse":{"properties":{"status":{"type":"string","title":"Status"},"version":{"type":"string","title":"Version"},"commit":{"type":"string","title":"Commit"},"uptime_seconds":{"type":"number","title":"Uptime Seconds"},"environment":{"type":"string","title":"Environment"},"db":{"type":"string","title":"Db"}},"type":"object","required":["status","version","commit","uptime_seconds","environment","db"],"title":"HealthResponse"},"SemanticSearchResponse":{"properties":{"query":{"type":"string","title":"Query"},"results":{"items":{"$ref":"#/components/schemas/SemanticSearchResult"},"type":"array","title":"Results"},"elapsed_ms":{"type":"number","title":"Elapsed Ms"}},"type":"object","required":["query","results","elapsed_ms"],"title":"SemanticSearchResponse"},"SemanticSearchResult":{"properties":{"book":{"$ref":"#/components/schemas/BookRead"},"similarity_score":{"type":"number","title":"Similarity Score"}},"type":"object","required":["book","similarity_score"],"title":"SemanticSearchResult"},"SummarySource":{"type":"string","enum":["user","ai"],"title":"SummarySource"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}