fastapi-router-versioning 1.2.0__tar.gz → 1.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/build-docs.yml +2 -2
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/bump-pre-commit-hooks.yml +2 -2
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/create-draft-release.yml +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/deploy-docs.yml +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/pre-commit.yml +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/prepare-release.yml +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/publish.yml +1 -1
- fastapi_router_versioning-1.2.2/.github/workflows/test-fastapi-main.yml +52 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/test.yml +14 -6
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/zizmor.yml +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/PKG-INFO +15 -15
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/README.md +9 -9
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/advanced/callbacks-and-webhooks.md +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/advanced/deprecation-headers.md +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/advanced/multiple-routers.md +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/advanced/reverse-proxy-and-sub-apps.md +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/advanced/self-hosted-assets.md +2 -2
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/advanced/validation-error-status-code.md +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/advanced/version-discovery.md +1 -1
- fastapi_router_versioning-1.2.2/docs/assets/screenshots/migration-root.jpg +0 -0
- fastapi_router_versioning-1.2.2/docs/assets/screenshots/swagger-v3.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/examples.md +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/how-it-works.md +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/index.md +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/lifecycle.md +20 -5
- fastapi_router_versioning-1.2.2/docs/migrating.md +64 -0
- fastapi_router_versioning-1.2.2/docs/release-notes.md +280 -0
- fastapi_router_versioning-1.2.2/docs_src/migration/adopt.py +22 -0
- fastapi_router_versioning-1.2.2/docs_src/migration/change_endpoint.py +26 -0
- fastapi_router_versioning-1.2.2/docs_src/migration/retire_unversioned.py +25 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/fastapi_router_versioning/__init__.py +1 -1
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/fastapi_router_versioning/_compat.py +7 -6
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/mkdocs.yml +7 -6
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/pyproject.toml +7 -6
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/scripts/docs_screenshots.py +2 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/scripts/generate_readme.py +5 -5
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_docs_src_behavior.py +31 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_versioner.py +111 -2
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/uv.lock +440 -364
- fastapi_router_versioning-1.2.0/docs/release-notes.md +0 -242
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/dependabot.yml +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/latest-changes.yml +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/detect-conflicts.yml +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/guard-dependencies.yml +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/test-redistribute.yml +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.gitignore +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.pre-commit-config.yaml +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.python-version +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/LICENSE +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/advanced/callback-hook.md +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/advanced/custom-url-format.md +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/advanced/index.md +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/advanced/latest-alias.md +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/advanced/openapi-hook.md +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/images/apple-touch-icon.png +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/images/favicon.ico +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/images/favicon.png +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/images/favicon.svg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/images/logo-header.svg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/images/logo.svg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/images/wordmark.png +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/screenshots/latest-alias.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/screenshots/quickstart-calver.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/screenshots/quickstart-semver-v1.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/screenshots/quickstart-semver-v2.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/screenshots/redoc-v2.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/screenshots/swagger-v1.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/screenshots/swagger-v2.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/screenshots/url-format-latest.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/screenshots/url-format-v1.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/screenshots/versions-dashboard.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/screenshots/webhooks-v1.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/assets/screenshots/webhooks-v2.jpg +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/quickstart.md +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/reference.md +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs/stylesheets/extra.css +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/advanced/callback_hook.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/advanced/callbacks.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/advanced/custom_url_format.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/advanced/deprecation_headers.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/advanced/latest_alias.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/advanced/multiple_routers.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/advanced/openapi_hook.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/advanced/reverse_proxy.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/advanced/self_hosted_assets.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/advanced/validation_error_status_code.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/advanced/version_discovery.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/advanced/webhooks.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/lifecycle/legacy_route.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/quickstart/calver.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/docs_src/quickstart/semver.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/calver_app.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/dashboard_assets/versions_dashboard.css +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/dashboard_assets/versions_dashboard.html +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/deprecation_headers_app.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/download_static_assets.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/mounted_subapps_app.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/multi_router_app.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/openapi_hook_app.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/self_hosted_docs_app.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/semver_app.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/semver_major_only_app.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/validation_override_integration_app.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/versions_dashboard_app.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/versions_dashboard_hook_app.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/examples/webhook_versioning_app.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/fastapi_router_versioning/_builder.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/fastapi_router_versioning/_dashboard.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/fastapi_router_versioning/_deprecation.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/fastapi_router_versioning/_docs.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/fastapi_router_versioning/_lifecycle.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/fastapi_router_versioning/_registry.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/fastapi_router_versioning/_scheme.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/fastapi_router_versioning/_versions.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/fastapi_router_versioning/py.typed +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/fastapi_router_versioning/versioner.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/overrides/main.html +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/scripts/build_icons.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/scripts/docs-build.sh +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/scripts/docs.sh +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/scripts/format.sh +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/scripts/lint.sh +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/scripts/prepare_release.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/scripts/test-cov-html.sh +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/scripts/test-cov.sh +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/scripts/test.sh +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/__init__.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_calver.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_docs_src.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_examples.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_fastapi_integration.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_prepare_release.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_public_signature_docs.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_readme.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_semver.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_versioner_deprecation_headers.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_versioner_docs.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_versioner_errors.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_versioner_lifecycle.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_versioner_versions_dashboard.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_versioner_versions_route.py +0 -0
- {fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/tests/test_versioner_webhooks.py +0 -0
{fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/build-docs.yml
RENAMED
|
@@ -61,7 +61,7 @@ jobs:
|
|
|
61
61
|
python-version-file: .python-version
|
|
62
62
|
|
|
63
63
|
- name: Setup uv
|
|
64
|
-
uses: astral-sh/setup-uv@
|
|
64
|
+
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v9.0.0 #sync-pin:setup-uv-4
|
|
65
65
|
with:
|
|
66
66
|
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
67
67
|
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
@@ -76,7 +76,7 @@ jobs:
|
|
|
76
76
|
run: uv run --no-sync bash scripts/docs-build.sh
|
|
77
77
|
|
|
78
78
|
# The site is deployed by Deploy Docs, which runs once this workflow has finished
|
|
79
|
-
- uses: actions/upload-artifact@
|
|
79
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.1 #sync-pin:upload-artifact-3
|
|
80
80
|
with:
|
|
81
81
|
name: docs-site
|
|
82
82
|
path: ./site
|
|
@@ -9,7 +9,7 @@ permissions: {}
|
|
|
9
9
|
|
|
10
10
|
jobs:
|
|
11
11
|
bump-pre-commit-hooks:
|
|
12
|
-
if: github.repository_owner == '
|
|
12
|
+
if: github.repository_owner == 'matblack81'
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
14
|
timeout-minutes: 10
|
|
15
15
|
steps:
|
|
@@ -25,7 +25,7 @@ jobs:
|
|
|
25
25
|
with:
|
|
26
26
|
python-version-file: ".python-version"
|
|
27
27
|
- name: Setup uv
|
|
28
|
-
uses: astral-sh/setup-uv@
|
|
28
|
+
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v9.0.0 #sync-pin:setup-uv
|
|
29
29
|
with:
|
|
30
30
|
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
31
31
|
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
@@ -31,7 +31,7 @@ jobs:
|
|
|
31
31
|
with:
|
|
32
32
|
python-version-file: ".python-version"
|
|
33
33
|
- name: Install uv
|
|
34
|
-
uses: astral-sh/setup-uv@
|
|
34
|
+
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v9.0.0 #sync-pin:setup-uv
|
|
35
35
|
with:
|
|
36
36
|
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
37
37
|
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
@@ -39,7 +39,7 @@ jobs:
|
|
|
39
39
|
mkdir ./site
|
|
40
40
|
# Build Docs is skipped when nothing that goes into the site changed: it uploads no artifact,
|
|
41
41
|
# the download below finds nothing, and the steps that need ./site/ are skipped
|
|
42
|
-
- uses: actions/download-artifact@
|
|
42
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.1 #sync-pin:download-artifact-2
|
|
43
43
|
with:
|
|
44
44
|
path: ./site/
|
|
45
45
|
pattern: docs-site
|
{fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/pre-commit.yml
RENAMED
|
@@ -30,7 +30,7 @@ jobs:
|
|
|
30
30
|
python-version-file: ".python-version"
|
|
31
31
|
|
|
32
32
|
- name: Setup uv
|
|
33
|
-
uses: astral-sh/setup-uv@
|
|
33
|
+
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v9.0.0 #sync-pin:setup-uv
|
|
34
34
|
with:
|
|
35
35
|
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
36
36
|
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
@@ -42,7 +42,7 @@ jobs:
|
|
|
42
42
|
with:
|
|
43
43
|
python-version-file: ".python-version"
|
|
44
44
|
- name: Install uv
|
|
45
|
-
uses: astral-sh/setup-uv@
|
|
45
|
+
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v9.0.0 #sync-pin:setup-uv
|
|
46
46
|
with:
|
|
47
47
|
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
48
48
|
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
{fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/publish.yml
RENAMED
|
@@ -28,7 +28,7 @@ jobs:
|
|
|
28
28
|
with:
|
|
29
29
|
python-version-file: ".python-version"
|
|
30
30
|
- name: Install uv
|
|
31
|
-
uses: astral-sh/setup-uv@
|
|
31
|
+
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v9.0.0 #sync-pin:setup-uv
|
|
32
32
|
with:
|
|
33
33
|
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
34
34
|
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Test FastAPI main
|
|
2
|
+
|
|
3
|
+
# Early warning, not a gate: runs the suite against FastAPI's development branch so that
|
|
4
|
+
# routing changes show up before they are released. Never runs on pull requests and is not
|
|
5
|
+
# part of any required check.
|
|
6
|
+
on:
|
|
7
|
+
schedule:
|
|
8
|
+
# cron every week on monday
|
|
9
|
+
- cron: "0 0 * * 1"
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions: {}
|
|
13
|
+
|
|
14
|
+
env:
|
|
15
|
+
UV_NO_SYNC: true
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
test-fastapi-main:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
timeout-minutes: 15
|
|
21
|
+
env:
|
|
22
|
+
UV_PYTHON: "3.14"
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 #sync-pin:checkout
|
|
26
|
+
with:
|
|
27
|
+
persist-credentials: false
|
|
28
|
+
|
|
29
|
+
- name: Set up Python
|
|
30
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 #sync-pin:setup-python
|
|
31
|
+
with:
|
|
32
|
+
python-version: "3.14"
|
|
33
|
+
|
|
34
|
+
- name: Setup uv
|
|
35
|
+
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v9.0.0 #sync-pin:setup-uv
|
|
36
|
+
with:
|
|
37
|
+
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
38
|
+
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
39
|
+
version: "0.11.18"
|
|
40
|
+
enable-cache: true
|
|
41
|
+
cache-dependency-glob: |
|
|
42
|
+
pyproject.toml
|
|
43
|
+
uv.lock
|
|
44
|
+
|
|
45
|
+
- name: Install Dependencies
|
|
46
|
+
run: uv sync
|
|
47
|
+
|
|
48
|
+
- name: Install FastAPI from source
|
|
49
|
+
run: uv pip install -U "git+https://github.com/fastapi/fastapi@master"
|
|
50
|
+
|
|
51
|
+
- name: Test
|
|
52
|
+
run: uv run --no-sync bash scripts/test.sh
|
{fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/test.yml
RENAMED
|
@@ -60,6 +60,9 @@ jobs:
|
|
|
60
60
|
- python-version: "3.14"
|
|
61
61
|
fastapi-version: "latest"
|
|
62
62
|
coverage: "coverage"
|
|
63
|
+
# Covers the 0.137.2-0.143.0 band, which takes its own branch in _compat.py.
|
|
64
|
+
- python-version: "3.14"
|
|
65
|
+
fastapi-version: "0.143.0"
|
|
63
66
|
|
|
64
67
|
runs-on: ubuntu-latest
|
|
65
68
|
env:
|
|
@@ -81,7 +84,7 @@ jobs:
|
|
|
81
84
|
python-version: ${{ matrix.python-version }}
|
|
82
85
|
|
|
83
86
|
- name: Setup uv
|
|
84
|
-
uses: astral-sh/setup-uv@
|
|
87
|
+
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v9.0.0 #sync-pin:setup-uv
|
|
85
88
|
with:
|
|
86
89
|
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
87
90
|
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
@@ -99,6 +102,11 @@ jobs:
|
|
|
99
102
|
if: matrix.fastapi-version != 'latest'
|
|
100
103
|
run: uv pip install "fastapi==${{ matrix.fastapi-version }}"
|
|
101
104
|
|
|
105
|
+
# Without this, "latest" is whatever uv.lock pins, and only moves when Dependabot does.
|
|
106
|
+
- name: Upgrade to the latest FastAPI
|
|
107
|
+
if: matrix.fastapi-version == 'latest'
|
|
108
|
+
run: uv pip install -U fastapi
|
|
109
|
+
|
|
102
110
|
- name: Prepare coverage dir
|
|
103
111
|
run: mkdir coverage
|
|
104
112
|
|
|
@@ -111,7 +119,7 @@ jobs:
|
|
|
111
119
|
|
|
112
120
|
- name: Store coverage files
|
|
113
121
|
if: matrix.coverage == 'coverage'
|
|
114
|
-
uses: actions/upload-artifact@
|
|
122
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.1 #sync-pin:upload-artifact
|
|
115
123
|
with:
|
|
116
124
|
name: coverage-${{ matrix.python-version }}-${{ matrix.fastapi-version }}
|
|
117
125
|
path: coverage
|
|
@@ -169,7 +177,7 @@ jobs:
|
|
|
169
177
|
|
|
170
178
|
- name: Setup uv
|
|
171
179
|
if: steps.changed-tests.outputs.found == 'true'
|
|
172
|
-
uses: astral-sh/setup-uv@
|
|
180
|
+
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v9.0.0 #sync-pin:setup-uv-2
|
|
173
181
|
with:
|
|
174
182
|
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
175
183
|
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
@@ -211,7 +219,7 @@ jobs:
|
|
|
211
219
|
persist-credentials: false
|
|
212
220
|
|
|
213
221
|
- name: Setup uv
|
|
214
|
-
uses: astral-sh/setup-uv@
|
|
222
|
+
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v9.0.0 #sync-pin:setup-uv-3
|
|
215
223
|
with:
|
|
216
224
|
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
217
225
|
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
@@ -225,7 +233,7 @@ jobs:
|
|
|
225
233
|
run: uv sync --locked
|
|
226
234
|
|
|
227
235
|
- name: Get coverage files
|
|
228
|
-
uses: actions/download-artifact@
|
|
236
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.1 #sync-pin:download-artifact
|
|
229
237
|
with:
|
|
230
238
|
pattern: coverage-*
|
|
231
239
|
path: coverage
|
|
@@ -237,7 +245,7 @@ jobs:
|
|
|
237
245
|
- run: uv run coverage xml
|
|
238
246
|
|
|
239
247
|
- name: Store coverage HTML
|
|
240
|
-
uses: actions/upload-artifact@
|
|
248
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.1 #sync-pin:upload-artifact-2
|
|
241
249
|
with:
|
|
242
250
|
name: coverage-html
|
|
243
251
|
path: htmlcov
|
{fastapi_router_versioning-1.2.0 → fastapi_router_versioning-1.2.2}/.github/workflows/zizmor.yml
RENAMED
|
@@ -22,4 +22,4 @@ jobs:
|
|
|
22
22
|
with:
|
|
23
23
|
persist-credentials: false
|
|
24
24
|
- name: Run zizmor
|
|
25
|
-
uses: zizmorcore/zizmor-action@
|
|
25
|
+
uses: zizmorcore/zizmor-action@85b2b9fb8e3325e7a23d7d0a9d7ba5ae0f999e3e # v0.6.2 #sync-pin:zizmor-action
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fastapi-router-versioning
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: Router-based API versioning for FastAPI, with per-version docs and a declarative route lifecycle.
|
|
5
|
-
Project-URL: Homepage, https://
|
|
6
|
-
Project-URL: Repository, https://github.com/
|
|
7
|
-
Project-URL: Issues, https://github.com/
|
|
8
|
-
Project-URL: Documentation, https://
|
|
9
|
-
Project-URL: Changelog, https://
|
|
5
|
+
Project-URL: Homepage, https://fastapi-router-versioning.matblack81.com/
|
|
6
|
+
Project-URL: Repository, https://github.com/matblack81/fastapi-router-versioning
|
|
7
|
+
Project-URL: Issues, https://github.com/matblack81/fastapi-router-versioning/issues
|
|
8
|
+
Project-URL: Documentation, https://fastapi-router-versioning.matblack81.com/
|
|
9
|
+
Project-URL: Changelog, https://fastapi-router-versioning.matblack81.com/release-notes/
|
|
10
10
|
Author-email: Matteo Nieddu <mat81black@gmail.com>
|
|
11
11
|
License-Expression: MIT
|
|
12
12
|
License-File: LICENSE
|
|
@@ -31,24 +31,24 @@ Requires-Dist: fastapi!=0.137.0,!=0.137.1,>=0.120.0
|
|
|
31
31
|
Description-Content-Type: text/markdown
|
|
32
32
|
|
|
33
33
|
<p align="center">
|
|
34
|
-
<img src="https://raw.githubusercontent.com/
|
|
34
|
+
<img src="https://raw.githubusercontent.com/matblack81/fastapi-router-versioning/main/docs/assets/images/logo.svg" alt="FastAPI Router Versioning logo" width="128">
|
|
35
35
|
</p>
|
|
36
36
|
|
|
37
37
|
<h1 align="center">
|
|
38
|
-
<img src="https://raw.githubusercontent.com/
|
|
38
|
+
<img src="https://raw.githubusercontent.com/matblack81/fastapi-router-versioning/main/docs/assets/images/wordmark.png" alt="FastAPI Router Versioning" width="480">
|
|
39
39
|
</h1>
|
|
40
40
|
|
|
41
41
|
<p align="center">
|
|
42
|
-
<a href="https://github.com/
|
|
43
|
-
<a href="https://codecov.io/github/
|
|
42
|
+
<a href="https://github.com/matblack81/fastapi-router-versioning/actions"><img src="https://github.com/matblack81/fastapi-router-versioning/workflows/Test/badge.svg" alt="Build Status"></a>
|
|
43
|
+
<a href="https://codecov.io/github/matblack81/fastapi-router-versioning"><img src="https://codecov.io/github/matblack81/fastapi-router-versioning/graph/badge.svg?token=4WQ63Q7ESY" alt="codecov"></a>
|
|
44
44
|
<a href="https://pypi.org/project/fastapi-router-versioning/"><img src="https://img.shields.io/pypi/v/fastapi-router-versioning?color=%2334D058&label=pypi%20package" alt="pypi package"></a>
|
|
45
45
|
<a href="https://pypi.org/project/fastapi-router-versioning/"><img src="https://img.shields.io/pypi/pyversions/fastapi-router-versioning.svg?color=%2334D058" alt="Supported Python versions"></a>
|
|
46
|
-
<a href="https://github.com/
|
|
46
|
+
<a href="https://github.com/matblack81/fastapi-router-versioning/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License: MIT"></a>
|
|
47
47
|
</p>
|
|
48
48
|
|
|
49
49
|
Running multiple API versions side by side usually means duplicating routers, hand-rolling prefixes, or branching on request paths. `RouterVersioner` does it declaratively instead: annotate each route with the version it belongs to, and it generates the URL prefixes, the per-version OpenAPI schema, and the docs, without moving anything else in your app.
|
|
50
50
|
|
|
51
|
-
Documentation: https://
|
|
51
|
+
Documentation: https://fastapi-router-versioning.matblack81.com/
|
|
52
52
|
|
|
53
53
|
---
|
|
54
54
|
|
|
@@ -122,16 +122,16 @@ RouterVersioner(
|
|
|
122
122
|
).versionize()
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
CalVer, the route lifecycle, the parameter reference and the advanced options are in the [documentation](https://
|
|
125
|
+
CalVer, the route lifecycle, the parameter reference and the advanced options are in the [documentation](https://fastapi-router-versioning.matblack81.com/).
|
|
126
126
|
|
|
127
127
|
---
|
|
128
128
|
|
|
129
129
|
## Release Notes
|
|
130
130
|
|
|
131
|
-
[RELEASE_NOTES](https://github.com/
|
|
131
|
+
[RELEASE_NOTES](https://github.com/matblack81/fastapi-router-versioning/blob/main/docs/release-notes.md)
|
|
132
132
|
|
|
133
133
|
---
|
|
134
134
|
|
|
135
135
|
## License
|
|
136
136
|
|
|
137
|
-
[MIT](https://github.com/
|
|
137
|
+
[MIT](https://github.com/matblack81/fastapi-router-versioning/blob/main/LICENSE)
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/
|
|
2
|
+
<img src="https://raw.githubusercontent.com/matblack81/fastapi-router-versioning/main/docs/assets/images/logo.svg" alt="FastAPI Router Versioning logo" width="128">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h1 align="center">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/
|
|
6
|
+
<img src="https://raw.githubusercontent.com/matblack81/fastapi-router-versioning/main/docs/assets/images/wordmark.png" alt="FastAPI Router Versioning" width="480">
|
|
7
7
|
</h1>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
<a href="https://github.com/
|
|
11
|
-
<a href="https://codecov.io/github/
|
|
10
|
+
<a href="https://github.com/matblack81/fastapi-router-versioning/actions"><img src="https://github.com/matblack81/fastapi-router-versioning/workflows/Test/badge.svg" alt="Build Status"></a>
|
|
11
|
+
<a href="https://codecov.io/github/matblack81/fastapi-router-versioning"><img src="https://codecov.io/github/matblack81/fastapi-router-versioning/graph/badge.svg?token=4WQ63Q7ESY" alt="codecov"></a>
|
|
12
12
|
<a href="https://pypi.org/project/fastapi-router-versioning/"><img src="https://img.shields.io/pypi/v/fastapi-router-versioning?color=%2334D058&label=pypi%20package" alt="pypi package"></a>
|
|
13
13
|
<a href="https://pypi.org/project/fastapi-router-versioning/"><img src="https://img.shields.io/pypi/pyversions/fastapi-router-versioning.svg?color=%2334D058" alt="Supported Python versions"></a>
|
|
14
|
-
<a href="https://github.com/
|
|
14
|
+
<a href="https://github.com/matblack81/fastapi-router-versioning/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License: MIT"></a>
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
17
|
Running multiple API versions side by side usually means duplicating routers, hand-rolling prefixes, or branching on request paths. `RouterVersioner` does it declaratively instead: annotate each route with the version it belongs to, and it generates the URL prefixes, the per-version OpenAPI schema, and the docs, without moving anything else in your app.
|
|
18
18
|
|
|
19
|
-
Documentation: https://
|
|
19
|
+
Documentation: https://fastapi-router-versioning.matblack81.com/
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
@@ -90,16 +90,16 @@ RouterVersioner(
|
|
|
90
90
|
).versionize()
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
CalVer, the route lifecycle, the parameter reference and the advanced options are in the [documentation](https://
|
|
93
|
+
CalVer, the route lifecycle, the parameter reference and the advanced options are in the [documentation](https://fastapi-router-versioning.matblack81.com/).
|
|
94
94
|
|
|
95
95
|
---
|
|
96
96
|
|
|
97
97
|
## Release Notes
|
|
98
98
|
|
|
99
|
-
[RELEASE_NOTES](https://github.com/
|
|
99
|
+
[RELEASE_NOTES](https://github.com/matblack81/fastapi-router-versioning/blob/main/docs/release-notes.md)
|
|
100
100
|
|
|
101
101
|
---
|
|
102
102
|
|
|
103
103
|
## License
|
|
104
104
|
|
|
105
|
-
[MIT](https://github.com/
|
|
105
|
+
[MIT](https://github.com/matblack81/fastapi-router-versioning/blob/main/LICENSE)
|
|
@@ -19,7 +19,7 @@ each definition:
|
|
|
19
19
|
--8<-- "docs_src/advanced/webhooks.py:snippet"
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
In [`webhook_versioning_app.py`](https://github.com/
|
|
22
|
+
In [`webhook_versioning_app.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/webhook_versioning_app.py), which follows this pattern, v1.0 lists two webhooks and v2.0 only `order-created`, with its v2 definition (the example's second webhook is `payment-received` rather than `payment-failed`):
|
|
23
23
|
|
|
24
24
|
=== "v1.0"
|
|
25
25
|
|
|
@@ -33,4 +33,4 @@ config). `versionize()` raises `ValueError` if a route's `remove_in` date preced
|
|
|
33
33
|
This adds nothing to `@api_version`: the lifecycle stays on the route, the dates stay on the
|
|
34
34
|
versioner. `Deprecation` and `Sunset` are only set if the response doesn't already carry them:
|
|
35
35
|
a route that sets its own keeps it. The `Link` field is sent alongside any the route already
|
|
36
|
-
emits (RFC 8288: multiple `Link` fields combine). See [`deprecation_headers_app.py`](https://github.com/
|
|
36
|
+
emits (RFC 8288: multiple `Link` fields combine). See [`deprecation_headers_app.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/deprecation_headers_app.py).
|
|
@@ -15,7 +15,7 @@ Sharing one app across several `RouterVersioner` instances only makes sense for
|
|
|
15
15
|
mixing `version_format` values, SemVer for one group of routes and CalVer for another, on
|
|
16
16
|
the same app. Splitting modules that share a `version_format` doesn't need a second instance;
|
|
17
17
|
pass them all to one `RouterVersioner` via `routers=[...]` instead (see
|
|
18
|
-
[`multi_router_app.py`](https://github.com/
|
|
18
|
+
[`multi_router_app.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/multi_router_app.py)).
|
|
19
19
|
If you do share an app across instances, one rule is enforced: every instance needs
|
|
20
20
|
its own `prefix_format`/`latest_prefix`. Two instances that resolve to the same prefix would
|
|
21
21
|
otherwise overwrite each other's docs/openapi routes at the same path; this raises
|
|
@@ -14,4 +14,4 @@ The ASGI `root_path` FastAPI sets when an app runs behind a proxy or is mounted
|
|
|
14
14
|
A mounted sub-application is a separate `FastAPI()` instance, so a `RouterVersioner` attached to
|
|
15
15
|
it is entirely independent from one attached to the parent, or to another sub-application, with
|
|
16
16
|
no prefix coordination needed.
|
|
17
|
-
See [`examples/mounted_subapps_app.py`](https://github.com/
|
|
17
|
+
See [`examples/mounted_subapps_app.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/mounted_subapps_app.py).
|
|
@@ -11,5 +11,5 @@ copies for air-gapped or restricted-network deployments:
|
|
|
11
11
|
--8<-- "docs_src/advanced/self_hosted_assets.py:snippet"
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
[`examples/download_static_assets.py`](https://github.com/
|
|
15
|
-
[`examples/self_hosted_docs_app.py`](https://github.com/
|
|
14
|
+
[`examples/download_static_assets.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/download_static_assets.py) downloads the required files in one step;
|
|
15
|
+
[`examples/self_hosted_docs_app.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/self_hosted_docs_app.py) wires them into a full app.
|
|
@@ -19,4 +19,4 @@ uv add fastapi-validation-override
|
|
|
19
19
|
--8<-- "docs_src/advanced/validation_error_status_code.py:snippet"
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
See [`examples/validation_override_integration_app.py`](https://github.com/
|
|
22
|
+
See [`examples/validation_override_integration_app.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/validation_override_integration_app.py).
|
|
@@ -46,4 +46,4 @@ if you want them).
|
|
|
46
46
|
|
|
47
47
|

|
|
48
48
|
|
|
49
|
-
The built-in dashboard, from [`versions_dashboard_app.py`](https://github.com/
|
|
49
|
+
The built-in dashboard, from [`versions_dashboard_app.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/versions_dashboard_app.py).
|
|
Binary file
|
|
@@ -128,4 +128,4 @@ Custom validation error status code via `fastapi-validation-override` and `opena
|
|
|
128
128
|
|
|
129
129
|
## Support files
|
|
130
130
|
|
|
131
|
-
[`download_static_assets.py`](https://github.com/
|
|
131
|
+
[`download_static_assets.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/download_static_assets.py) downloads the Swagger UI and ReDoc files used by `self_hosted_docs_app.py`, and the [`dashboard_assets/`](https://github.com/matblack81/fastapi-router-versioning/tree/main/examples/dashboard_assets) folder holds the template and stylesheet of `versions_dashboard_hook_app.py`.
|
|
@@ -22,7 +22,7 @@ Every version mentioned by any route, as `version`, `deprecate_in` or `remove_in
|
|
|
22
22
|
|
|
23
23
|
Because the key is the path *and* the method, one method of a route can be replaced while the others carry on, and a version that only removes routes still exists, with no routes at all if nothing else is active.
|
|
24
24
|
|
|
25
|
-
For [`semver_app.py`](https://github.com/
|
|
25
|
+
For [`semver_app.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/semver_app.py) this gives:
|
|
26
26
|
|
|
27
27
|
| Version | Routes served |
|
|
28
28
|
|---|---|
|
|
@@ -19,7 +19,7 @@ Running multiple API versions side by side usually means duplicating routers, ha
|
|
|
19
19
|
|
|
20
20
|
## What you get
|
|
21
21
|
|
|
22
|
-
Every version gets its own Swagger UI, ReDoc and `openapi.json`, listing only the routes active in that version. These screenshots come from [`semver_app.py`](https://github.com/
|
|
22
|
+
Every version gets its own Swagger UI, ReDoc and `openapi.json`, listing only the routes active in that version. These screenshots come from [`semver_app.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/semver_app.py), where `/lifecycle` and `/legacy-notice` are deprecated in v2.0, `/newcomer` is added in v2.0, and a dedicated route takes over `POST /settings`.
|
|
23
23
|
|
|
24
24
|
=== "Swagger UI, v1.0"
|
|
25
25
|
|
|
@@ -43,17 +43,32 @@ ever turns deprecation *on* for versions at or after its boundary; it never turn
|
|
|
43
43
|
|
|
44
44
|
A route with `methods=["GET", "POST"]` can have just one of its methods taken over by a
|
|
45
45
|
dedicated route in a later version; the other method keeps being served by the original
|
|
46
|
-
route. See [`semver_app.py`](https://github.com/
|
|
46
|
+
route. See [`semver_app.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/semver_app.py)
|
|
47
47
|
for a working example.
|
|
48
48
|
|
|
49
49
|
## In the generated docs
|
|
50
50
|
|
|
51
51
|
In each version's Swagger UI and ReDoc, a route in its deprecation window is struck through, a route
|
|
52
|
-
removed from a version is absent, and a route introduced later appears only from that version.
|
|
53
|
-
v2.0 of [`semver_app.py`](https://github.com/
|
|
54
|
-
`/lifecycle` and `/legacy-notice` are deprecated from v2.0, and `/newcomer` is introduced in it.
|
|
52
|
+
removed from a version is absent, and a route introduced later appears only from that version. These are
|
|
53
|
+
v1.0, v2.0 and v3.0 of [`semver_app.py`](https://github.com/matblack81/fastapi-router-versioning/blob/main/examples/semver_app.py):
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
=== "v1.0"
|
|
56
|
+
|
|
57
|
+
`/lifecycle` and `/legacy-notice` are active, and `/newcomer` and `/future` don't exist yet.
|
|
58
|
+
|
|
59
|
+
{ loading=lazy }
|
|
60
|
+
|
|
61
|
+
=== "v2.0"
|
|
62
|
+
|
|
63
|
+
`/lifecycle` and `/legacy-notice` are deprecated from v2.0, and `/newcomer` is introduced in it.
|
|
64
|
+
|
|
65
|
+
{ loading=lazy }
|
|
66
|
+
|
|
67
|
+
=== "v3.0"
|
|
68
|
+
|
|
69
|
+
`/lifecycle` is removed. `/legacy-notice` has no `remove_in`, so it stays, still deprecated, and `/future` is introduced.
|
|
70
|
+
|
|
71
|
+
{ loading=lazy }
|
|
57
72
|
|
|
58
73
|
## Deprecation headers
|
|
59
74
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Add RouterVersioner to a FastAPI app that already has clients, without breaking the URLs they call.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Adding it to an existing app
|
|
6
|
+
|
|
7
|
+
You don't have to rewrite anything to start. A route without `@api_version` is given
|
|
8
|
+
`default_version`, which is v1.0 under SemVer, so the app you have today is already "version 1".
|
|
9
|
+
The steps below keep the unversioned URLs working while your clients move to the versioned ones.
|
|
10
|
+
|
|
11
|
+
## 1. Versionize what you have
|
|
12
|
+
|
|
13
|
+
This is an ordinary app, with its router included once:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
--8<-- "docs_src/migration/adopt.py:routes"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Pass the same router to `RouterVersioner` and call `.versionize()`, leaving everything above as it is:
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
--8<-- "docs_src/migration/adopt.py:versionize"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Nothing is decorated, so `GET /items` is mounted as `GET /v1_0/items`, with its own docs at `/v1_0/docs`.
|
|
26
|
+
`GET /items` keeps answering too: `app.include_router(router)` is still there, and `RouterVersioner` doesn't touch it.
|
|
27
|
+
|
|
28
|
+
## 2. Change an endpoint in a new version
|
|
29
|
+
|
|
30
|
+
Declare the new one at a higher version, next to the old one. The old function stays exactly as it was:
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
--8<-- "docs_src/migration/change_endpoint.py:snippet"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
| URL | Answered by |
|
|
37
|
+
|-----|-------------|
|
|
38
|
+
| `/items` | the original function, as before |
|
|
39
|
+
| `/v1_0/items` | the original function |
|
|
40
|
+
| `/v2_0/items` | the new function |
|
|
41
|
+
|
|
42
|
+
!!! note "The unversioned URL does not follow the new version"
|
|
43
|
+
|
|
44
|
+
`/items` is served by the router you included yourself, and FastAPI answers with the first route that matches: the original function. It never moves to v2.0, so clients still on it see no change.
|
|
45
|
+
|
|
46
|
+
The app's own docs, at `/docs`, list the unversioned URL together with every versioned one, while each version's docs list only its own routes:
|
|
47
|
+
|
|
48
|
+
{ loading=lazy }
|
|
49
|
+
|
|
50
|
+
!!! warning "Don't read the unversioned URL from `/docs`"
|
|
51
|
+
|
|
52
|
+
FastAPI keeps one operation per path and method in a schema, the last one declared. So `/docs` describes `/items` with the v2.0 function ("Get Items V2" above), while requests to `/items` are answered by the original one. Use `/v1_0/docs` and `/v2_0/docs` as the reference for what each version returns.
|
|
53
|
+
|
|
54
|
+
## 3. Retire the unversioned URLs
|
|
55
|
+
|
|
56
|
+
Once your clients call the versioned URLs, remove `app.include_router(router)`. If you still want a URL that always means "the newest", `latest_prefix` adds one:
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
--8<-- "docs_src/migration/retire_unversioned.py:snippet"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`/items` now answers 404, and `/latest/items` serves whichever version is highest: see the [latest alias](advanced/latest-alias.md).
|
|
63
|
+
|
|
64
|
+
Call `.versionize()` once, after every route is declared, as in the [Quick start](quickstart.md). To take a route out of a version later, or to mark it deprecated first, see the [route lifecycle](lifecycle.md).
|