Skip to content

v0.4.0

Choose a tag to compare

@feodor-ra feodor-ra released this 07 Jul 21:06
· 27 commits to master since this release
98f6cbd

Breaking Changes

  • VersioningMiddleware is now a plain ASGI middleware that builds versioning once on the first ASGI event: the dispatch constructor argument is gone, the class no longer subclasses BaseHTTPMiddleware, and routes added at runtime require an explicit rebuild_versioning() call (c526640)
  • The injected dependency value is an immutable VersionInfo named tuple instead of the shared VersioningSupport instance — annotate injected parameters as VersionInfo (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/origin metadata, kind-aware shadowing and VersionInfo injection 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 UserWarning is emitted for a non-int api_version and for an until below the declaring version; API_VERSION_KEY is exported; versioning() is annotated with its real return type (8d06122)

Fixes

  • FastAPI 0.137+ router-tree support: endpoints registered through include_router are 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 0 is a valid api_version, and bool is 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/origin no longer leak between routes sharing a router-level versioning() dependency (2f3a215)
  • dependency_overrides of 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.py renamed, 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