Repository navigation
FastAPI 0.145 removed FastAPI(**extra), so declaring a version with FastAPI(api_version=N) stopped working there. This release adds versionize(app, version) to declare versions explicitly and lifts the <0.145 cap from 0.4.2, so FastAPI 0.145+ is supported again.
⚠️ Upgrade notes
With the cap lifted, a fresh install may resolve FastAPI 0.145+, where FastAPI(api_version=N) raises TypeError — FastAPI itself rejects the keyword. Before upgrading to 0.5.0, switch every version declaration to versionize, one line per version:
# before
app_v1 = FastAPI(api_version=1)
# after
from fastapi_easy_versioning import versionize
app_v1 = versionize(FastAPI(), 1)If you cannot migrate yet, pin fastapi<0.145: the old keyword keeps working there, with a FutureWarning. See the migration notes.
Added
versionize(app, version)declares a sub-application's version and returns the same app, soapp.mount("/v1", versionize(FastAPI(), 1))works. Wrong argument types raiseTypeError, and declaring an app with another version raisesValueError. by @feodor-ra in dfd7caf
Changed
- Breaking: the
<0.145cap is lifted — FastAPI 0.145+ is supported again; read the upgrade notes above before upgrading. by @feodor-ra in 962e2d0
Deprecated
FastAPI(api_version=N)andAPI_VERSION_KEY— the keyword keeps working on FastAPI < 0.145 when an app has noversionizedeclaration, and itsFutureWarningnow names the affected mounts and points toversionize. Both will be removed together with support for FastAPI < 0.145. by @feodor-ra in dfd7caf
Documentation
- Every example declares versions with
versionize, and the middleware guide gained a Migrating from 0.4.x section, in English and Russian. by @feodor-ra in 5cc54b7
📖 https://feodor-ra.github.io/fastapi-easy-versioning/
Full Changelog: v0.4.2...v0.5.0