{"id":15020965,"url":"https://github.com/kludex/fastapi-responses","last_synced_at":"2025-04-09T23:17:04.398Z","repository":{"id":41162556,"uuid":"320084355","full_name":"Kludex/fastapi-responses","owner":"Kludex","description":"Find HTTPExceptions and turn them into documented responses! :tada:","archived":false,"fork":false,"pushed_at":"2023-09-27T05:00:06.000Z","size":146,"stargazers_count":99,"open_issues_count":14,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T23:16:58.763Z","etag":null,"topics":["fastapi","openapi","python"],"latest_commit_sha":null,"homepage":"https://github.com/Kludex/fastapi-responses","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kludex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-12-09T21:30:43.000Z","updated_at":"2024-11-07T19:12:41.000Z","dependencies_parsed_at":"2024-01-14T06:56:11.778Z","dependency_job_id":null,"html_url":"https://github.com/Kludex/fastapi-responses","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"72dbf4d19a1dce5adf3f9a756107462b9f0e29a0"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kludex%2Ffastapi-responses","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kludex%2Ffastapi-responses/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kludex%2Ffastapi-responses/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kludex%2Ffastapi-responses/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kludex","download_url":"https://codeload.github.com/Kludex/fastapi-responses/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125593,"owners_count":21051771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","openapi","python"],"created_at":"2024-09-24T19:55:57.232Z","updated_at":"2025-04-09T23:17:04.377Z","avatar_url":"https://github.com/Kludex.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    \u003cstrong\u003eFastAPI Responses\u003c/strong\u003e\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/Kludex/fastapi-responses\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/last-commit/Kludex/fastapi-responses\" alt=\"Latest Commit\"\u003e\n    \u003c/a\u003e\n        \u003cimg src=\"https://img.shields.io/github/workflow/status/Kludex/fastapi-responses/Test\"\u003e\n        \u003cimg src=\"https://img.shields.io/codecov/c/github/Kludex/fastapi-responses\"\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://pypi.org/project/fastapi-responses\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/pypi/v/fastapi-responses\" alt=\"Package version\"\u003e\n    \u003c/a\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/fastapi-responses\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/Kludex/fastapi-responses\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    Find \u003cb\u003eHTTPException\u003c/b\u003es and turn them into documented \u003cb\u003eresponses\u003c/b\u003e. :tada:\n\u003c/p\u003e\n\n## Installation\n\n``` bash\npip install fastapi-responses\n```\n\n## Usage\n\nThe simplest use case happens when we have a single exception being raised. We don't want to document the possible response manually, so **FastAPI Responses** comes in handy.\n\n``` python\nfrom fastapi import FastAPI, HTTPException\nfrom fastapi_responses import custom_openapi\n\napp = FastAPI()\n\napp.openapi = custom_openapi(app)\n\n@app.get(\"/{item_id}\")\ndef get_item(item_id: int):\n    if item_id == 0:\n        raise HTTPException(status_code=404, detail=\"Item not found.\")\n    return \"Item exists!\"\n```\n\n### Without FastAPI Responses\n\n\u003cimg src=\"./assets/without.jpg\" width=\"1000\" title=\"Without FastAPI responses\"\u003e\n\n### With FastAPI Responses\n\n\u003cimg src=\"./assets/with.jpg\" width=\"1000\" title=\"With FastAPI responses\"\u003e\n\n## Roadmap\n\n- [X] Extract HTTPException from stack.\n- [ ] Extract any exception and document based on the `exception_handler` container.\n- [ ] Accept Python objects on `HTTPException` instantiation.\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkludex%2Ffastapi-responses","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkludex%2Ffastapi-responses","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkludex%2Ffastapi-responses/lists"}