FastAPI 0.155.0 is a breaking release: the deprecated arbitrary extra keyword arguments have been removed from all request parameter helpers. This change, PR #16545 by @tiangolo, means the previous escape hatch for passing custom metadata through a parameter declaration is gone. Code that relied on it will now fail at import or definition time rather than being silently accepted.
What changed in practice:
- Removed extra kwargs from
Path,Query,Header,Cookie,Body,Form, andFile. Passing keys these classes do not define no longer works. - Unknown keyword arguments now raise
TypeError. A call such asQuery(custom="value")errors instead of being swallowed. json_schema_extrais the replacement for custom JSON Schema properties. RewriteQuery(custom="value")asQuery(json_schema_extra={"custom": "value"}).- Breaking change classification: this is flagged as a breaking change in the release, so pinning matters for projects mid-upgrade.
The migration is mechanical but worth auditing. Search for places where you passed undocumented keys to these constructors, especially in shared parameter factories or internal helper functions, and move those keys into json_schema_extra. Because the failure mode is a TypeError, most problems surface as soon as the module is imported, which makes the fix path straightforward. The upside is stricter signatures: typos in parameter names no longer pass unnoticed, and generated OpenAPI schemas stay predictable. If you cannot upgrade immediately, pin fastapi below 0.155.0 and schedule the cleanup; otherwise upgrade and run your schema tests.
Source: https://github.com/fastapi/fastapi/releases/tag/0.155.0