v0.4.0
Breaking Changes
VersioningMiddlewareis now a plain ASGI middleware that builds versioning once on the first ASGI event: thedispatchconstructor argument is gone, the class no longer subclassesBaseHTTPMiddleware, and routes added at runtime require an explicitrebuild_versioning()call (c526640)- The injected dependency value is an immutable
VersionInfonamed tuple instead of the sharedVersioningSupportinstance — annotate injected parameters asVersionInfo(2f3a215) - Inherited routes are copies: mutating a route in one version no longer affects other versions (a1decca)
- Python 3.9 support is dropped — the package now requires Python >= 3.10 (f8f6bbb)
Features
- WebSocket routes are versioned with full HTTP parity: inheritance,
until/originmetadata, kind-aware shadowing andVersionInfoinjection in WebSocket endpoints (7034542) - New public
rebuild_versioning(app)picks up routes or versions added at runtime and refreshes the OpenAPI schemas (c526640) - Misconfiguration is no longer silent: a
UserWarningis emitted for a non-intapi_versionand for anuntilbelow the declaring version;API_VERSION_KEYis exported;versioning()is annotated with its real return type (8d06122)
Fixes
- FastAPI 0.137+ router-tree support: endpoints registered through
include_routerare versioned correctly again, including include-time prefixes and dependencies; fastapi 0.137.0/0.137.1 are excluded via dependency constraints (b6f9eb9) - Middleware attached to an app without versioned sub-apps no longer crashes every request (3d8dca0)
- Version
0is a validapi_version, andboolis no longer accepted as a version (7fa7a75) - Redefining an endpoint in a newer version now shadows the inherited one in the OpenAPI schema, not only at runtime (a1decca)
until/originno longer leak between routes sharing a router-levelversioning()dependency (2f3a215)dependency_overridesof inherited routes are resolved by the app of the version serving the request (a1decca)
Internal
- CI additionally tests against the minimum supported (0.95), the last pre-router-tree (0.136) and the latest FastAPI (8bf71ae)
- Tests: vacuous assertions fixed, client fixture properly closed,
test_depenpency.pyrenamed, new regression coverage for every fix above (ee00da1) - Documentation expanded and clarified (RU/EN); the English pages are now a maintained first-class translation (77e5e46, b8734e6)
- Dev tooling: httpx replaced with httpx2 in tests, Justfile with common dev commands (d63d509, f6e8918)
Full Changelog: v0.3.0...v0.4.0