{"id":26090510,"url":"https://github.com/mxnoob/fastapi-header-versions","last_synced_at":"2026-04-17T23:31:58.103Z","repository":{"id":281172216,"uuid":"944400473","full_name":"mxnoob/fastapi-header-versions","owner":"mxnoob","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-07T11:13:19.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-07T11:34:38.562Z","etag":null,"topics":["fastapi"],"latest_commit_sha":null,"homepage":"","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/mxnoob.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-07T09:30:39.000Z","updated_at":"2025-03-07T10:54:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"670f0ab5-1923-4fc5-92df-282f2041eef2","html_url":"https://github.com/mxnoob/fastapi-header-versions","commit_stats":null,"previous_names":["mxnoob/fastapi-header-versions"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxnoob%2Ffastapi-header-versions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxnoob%2Ffastapi-header-versions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxnoob%2Ffastapi-header-versions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxnoob%2Ffastapi-header-versions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mxnoob","download_url":"https://codeload.github.com/mxnoob/fastapi-header-versions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242673793,"owners_count":20167294,"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"],"created_at":"2025-03-09T09:34:24.903Z","updated_at":"2026-04-17T23:31:58.094Z","avatar_url":"https://github.com/mxnoob.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastapi-header-versions\n\nThis package adds versioning by Accept-header into FastAPI\n\n### Installation\n```shell\npip install fastapi-header-versions\n```\n\n### Defining app and routes\n\n```python\nfrom enum import StrEnum\nimport fastapi\n\nfrom fastapi_header_version import VersionedRouter, InlineVersionedRouter, init_fastapi_versioning\n\n\nclass AppType(StrEnum):\n    some_name: \"some.name\"\n    some_name2: \"some.name2\"\n\n\nrouter = VersionedRouter()\ninline_router = InlineVersionedRouter()\n\n\n@router.get(\"/test/\")\n@router.set_api_version((1, 0), app_names={AppType.some_name, AppType.some_name2})\nasync def test_get() -\u003e dict:\n    return {\"version\": (1, 0)}\n\n\n@inline_router.get(\"/test/\", version=1, app_names=AppType.some_name)\nasync def test_get_v1() -\u003e dict:\n    return {\"version\": (2, 0)}\n\n\n@inline_router.get(\"/test/\", version=(2, 0), app_names=AppType.some_name)\nasync def test_get_v2() -\u003e dict:\n    return {\"version\": (2, 0)}\n\n\napp = fastapi.FastAPI()\napp.include_router(router)\napp.include_router(inline_router)\ninit_fastapi_versioning(app=app)\n```\n\n### Query Examples\n```bash\n# call 1.0 version\ncurl -X 'GET' 'https://test.ru/test/' -H 'accept: application/vnd.some.name+json; version=1.0'\n\n# call 2.0 version\ncurl -X 'GET' 'https://test.ru/test/' -H 'accept: application/vnd.some.name+json; version=2.0'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxnoob%2Ffastapi-header-versions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmxnoob%2Ffastapi-header-versions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxnoob%2Ffastapi-header-versions/lists"}