FastAPI has released version 0.158.0, a feature-focused update that adds support for combining form models. The change, contributed by @tiangolo in PR #16577, extends how developers can declare and validate form data in their endpoints, moving beyond the previous one-model-per-parameter approach.
The headline addition in this release:
- Combining form models: endpoints can now accept multiple form model declarations together, letting a single request body be composed from more than one Pydantic model rather than being flattened into one structure.
- The feature centers on form handling, so it applies to endpoints that declare form-based parameters rather than JSON request bodies.
- The work landed via PR #16577, authored by @tiangolo, the framework's creator.
To pick up the change, upgrade with pip install --upgrade fastapi or pin fastapi==0.158.0 in your requirements. As with any minor release, review your existing form endpoints and their generated OpenAPI schema after upgrading, since the composition of multiple form models can affect how the request body is documented.
Why this matters: form data has long been the awkward sibling of JSON bodies in FastAPI. Declaring a single flat model forced developers to either duplicate fields or build nested structures manually, and validation across a shared set of fields was harder to express cleanly. Combining form models brings form payloads closer to the composable, model-driven style FastAPI users already rely on for JSON. Teams handling multipart uploads, HTML form submissions, or OAuth-style token endpoints can now split concerns across focused models, reuse those models in more places, and still get parsed, validated input in their path operation functions. If your API leans on forms, this release is worth testing in a branch before rolling it out broadly.
Source: https://github.com/fastapi/fastapi/releases/tag/0.158.0