{"openapi":"3.1.0","info":{"title":"Test Server Blog","description":"A small blog API.\n\nReading is public. Creating, updating and deleting posts needs the admin token:\npress **Authorize** and paste it, or send `Authorization: Bearer <token>`.\n","version":"1.0.0"},"paths":{"/healthz":{"get":{"tags":["meta"],"summary":"Liveness and database check","operationId":"healthz_healthz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}}}},"/api/posts":{"get":{"tags":["posts"],"summary":"List posts, newest first","operationId":"list_posts_api_posts_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":10,"title":"Page Size"}},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":100,"description":"Search in title, summary and body.","default":"","title":"Q"},"description":"Search in title, summary and body."},{"name":"include_drafts","in":"query","required":false,"schema":{"type":"boolean","description":"Admin only; ignored without a valid token.","default":false,"title":"Include Drafts"},"description":"Admin only; ignored without a valid token."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["posts"],"summary":"Create a post","operationId":"create_post_api_posts_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/posts/{slug}":{"get":{"tags":["posts"],"summary":"Read one post","operationId":"read_post_api_posts__slug__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["posts"],"summary":"Update a post","operationId":"update_post_api_posts__slug__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["posts"],"summary":"Delete a post","operationId":"delete_post_api_posts__slug__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"Health":{"properties":{"status":{"type":"string","title":"Status"},"posts":{"type":"integer","title":"Posts"},"version":{"type":"string","title":"Version"}},"type":"object","required":["status","posts","version"],"title":"Health"},"PostCreate":{"properties":{"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title","examples":["My first post"]},"body":{"type":"string","minLength":1,"title":"Body","description":"Markdown.","examples":["Some **Markdown** text."]},"summary":{"type":"string","maxLength":300,"title":"Summary","description":"Short teaser shown in lists.","default":""},"published":{"type":"boolean","title":"Published","description":"Drafts are visible to the admin only.","default":true},"slug":{"anyOf":[{"type":"string","maxLength":200,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},{"type":"null"}],"title":"Slug","description":"URL name. Derived from the title when omitted."}},"type":"object","required":["title","body"],"title":"PostCreate"},"PostOut":{"properties":{"id":{"type":"integer","title":"Id"},"slug":{"type":"string","title":"Slug"},"title":{"type":"string","title":"Title"},"summary":{"type":"string","title":"Summary"},"body":{"type":"string","title":"Body"},"published":{"type":"boolean","title":"Published"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","slug","title","summary","body","published","created_at","updated_at"],"title":"PostOut"},"PostPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PostOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["items","total","page","page_size"],"title":"PostPage"},"PostUpdate":{"properties":{"title":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Title"},"body":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Body"},"summary":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Summary"},"published":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Published"},"slug":{"anyOf":[{"type":"string","maxLength":200,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},{"type":"null"}],"title":"Slug"}},"type":"object","title":"PostUpdate","description":"Every field is optional; only the ones sent are changed."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"HTTPBearer":{"type":"http","description":"The admin token.","scheme":"bearer"}}},"tags":[{"name":"posts","description":"Blog posts."},{"name":"meta","description":"Service health."}]}