FastAPI 0.158.1 has been released, and it is a focused patch rather than a feature drop. The release fixes a regression in how generated OpenAPI schemas describe form-based request bodies. According to the release notes, the change preserves form media types in OpenAPI output, so endpoints that accept form data now advertise the correct content type in the generated specification instead of a substituted or incorrect one.
The fix comes from PR #16579, credited to @tiangolo, FastAPI's creator and maintainer. The release has no other listed changes, no new dependencies and no deprecations, which keeps the upgrade surface minimal for anyone already on a recent 0.158.x version.
- Fix: form media types are now preserved in OpenAPI (PR #16579 by @tiangolo)
- Scope: single targeted fix, no API additions or breaking changes
- Affected surface: request body content type entries for form endpoints in the generated schema
This matters because FastAPI's OpenAPI document is not just documentation. It drives the interactive /docs and /redoc pages, powers client SDK generation, and feeds contract tests and API gateways that validate requests against the spec. When a form endpoint's media type is wrong, generated clients can send the wrong Content-Type header, validators can reject legitimate form submissions, and downstream tooling can produce misleading errors that are hard to trace back to the schema. A one-line media type mismatch is easy to miss in review and expensive to debug in production.
For teams using Form parameters or python-multipart-backed endpoints, upgrading is a low-risk way to bring published schemas back in line with actual runtime behaviour. Pin fastapi==0.158.1 and regenerate your OpenAPI output to confirm form endpoints show the expected media types.
Source: https://github.com/fastapi/fastapi/releases/tag/0.158.1