FastAPI 0.149.0 introduces a breaking change to how form models handle empty values. Browsers submit empty text inputs as empty strings (""), and until now FastAPI passed those through to form models as real values. With this release, empty scalar form values are now treated as missing, matching the behavior developers already get from individual Form parameters.
The practical consequences for developers:
- Required fields that receive an empty string now return a validation error instead of accepting
""as a value. - Fields with defaults or default factories fall back to those defaults when the submitted scalar value is empty.
- Such fields remain unset in
model_dump(exclude_unset=True), so code relying on that method will no longer see an empty string for them. - Empty strings inside lists are preserved, so list-typed form fields keep the values the client sent.
- Omitted boolean form fields still become
False, as before. - JSON requests and direct Pydantic validation are unchanged; the new behavior applies only to scalar values in form models.
The change lands via PR #16529 by @tiangolo. Because it alters validation outcomes for existing form endpoints, it is flagged as breaking: a client that sends an empty text input to a required field will now get an error response where the previous version accepted the empty string.
Upgrading is a good moment to audit existing form models. If any endpoint intentionally accepted "" as a valid value, it now needs an explicit field type or default that reflects that intent, and clients should be checked for empty submissions. For most applications the release aligns behavior across Form parameters and form models, reducing the inconsistency developers hit when mixing both styles in the same route.
Source: https://github.com/fastapi/fastapi/releases/tag/0.149.0