Skip to content

v0.5.0

Latest

Choose a tag to compare

@feodor-ra feodor-ra released this 21 Oct 11:01
b815842

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, so app.mount("/v1", versionize(FastAPI(), 1)) works. Wrong argument types raise TypeError, and declaring an app with another version raises ValueError. by @feodor-ra in dfd7caf

Changed

  • Breaking: the <0.145 cap 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) and API_VERSION_KEY — the keyword keeps working on FastAPI < 0.145 when an app has no versionize declaration, and its FutureWarning now names the affected mounts and points to versionize. Both will be removed together with support for FastAPI < 0.145. by @feodor-ra in dfd7caf

Documentation

📖 https://feodor-ra.github.io/fastapi-easy-versioning/

Full Changelog: v0.4.2...v0.5.0