FastAPI 0.148.0

0.148.0
Changed 5
Fixed 1
  • Default handling for request parameters and models

2 changes to check, marked in the notes below

From FastAPI

Defaults for omitted Query, Header, Cookie, and Form parameters and model fields are no longer treated as user input. Defaults are not validated unless validate_default=True is enabled. If you rely on validators running for omitted values, enable default validation with Field(validate_default=True) for model fields or, for example, Query(validate_default=True) for individual parameters. Body(validate_default=True) is now honored too. behavior changed · inferred

For parameter models, applying a default no longer marks a field as explicitly set, so model_dump(exclude_unset=True) excludes it. Default factories run once, and validation errors no longer include injected defaults in input. behavior changed · inferred

Omitted boolean form fields still become False and count as explicitly set.

Breaking Changes
  • 🐛 Fix default handling for request parameters and models. PR #16527 by @tiangolo.
View original

Upgraded? How did it go?

Discussion