0.151.0
Changed 2
- JSON request bodies now distinguish an explicit null from an omitted value, so null is validated as None for individual Body parameters and defaults apply only when the value is omitted behavior changed · inferred, marked in the notes below
- Sending null as the entire body when a JSON object is expected because of Body(embed=True) or multiple body parameters now returns a validation error behavior changed · inferred, marked in the notes below
2 changes to check, marked in the notes below
From FastAPI
JSON request bodies now distinguish an explicit null from an omitted value. For individual Body parameters, null is validated as None: nullable types accept it, and non-nullable types reject it even when a default is defined. Defaults and default factories apply only when the value is omitted. This applies both to parameters inside JSON objects and to parameters representing the entire body. Clients that used null to request a default should omit the value instead. behavior changed · inferred
When a JSON object is expected because of Body(embed=True) or multiple body parameters, sending null as the entire body now returns a validation error. behavior changed · inferred