FastAPI has shipped version 0.161.0, a focused feature release that extends how form data can be modeled in request bodies. The headline addition is support for combining unions of form models, which broadens the type patterns developers can express when declaring endpoints that accept form-encoded input.
The change lands via a single pull request and is attributed to @tiangolo, FastAPI's creator and lead maintainer. Here is the concrete change set in this release:
- Union of form models support: FastAPI now supports combining unions of form models, allowing an endpoint to declare a request body that may resolve to one of several form-model variants. The implementation arrives in PR #16596.
- Form handling extension: This builds on the existing form and file parsing machinery, extending the union-composition behavior already available for other body types to form models.
- No other changes listed: The release notes for 0.161.0 describe this as a feature addition led by this single PR.
For developers, this closes a long-standing modeling gap. Previously, endpoints using Form parameters could not cleanly express a form body whose shape varies — for instance, a submission that could match one of two distinct form schemas. Composing the form models into a union means one route can validate and document multiple accepted form payloads, while keeping FastAPI's automatic request validation and generated OpenAPI schema in sync with the declared types. Teams building upload or multi-step submission endpoints can consolidate routes instead of duplicating handlers per form shape, and API consumers see the accepted variants reflected in the generated docs.
As always, review the release notes and test against your existing form endpoints before upgrading, since union-based body parsing can alter which model FastAPI selects for a given payload.
Source: https://github.com/fastapi/fastapi/releases/tag/0.161.0