0.162.0
Changed 3
- FastAPI no longer infers False for omitted boolean form fields, applying to individual form parameters, form models, and unions of form models
- Omitted boolean model fields are excluded from model_dump(exclude_unset=True)
- Defaults of omitted boolean model fields no longer count as submitted fields during union selection
Fixed 1
- Omitted bool and bool | None form fields now use their declared defaults or produce missing-field errors, consistent with other fields and Pydantic behavior behavior changed · inferred, marked in the notes below
1 change to check, marked in the notes below
From FastAPI
Omitted bool and bool | None form fields now use their declared defaults or produce missing-field errors, consistent with other fields and Pydantic behavior. FastAPI no longer infers False for omitted booleans. This applies to individual form parameters, form models, and unions of form models. behavior changed · inferred
Omitted boolean model fields are excluded from model_dump(exclude_unset=True), and their defaults no longer count as submitted fields during union selection. Default factories and validate_default follow the usual rules.
For HTML checkboxes, declare a boolean with a default of False. See Boolean Form Fields.