Upgrading fastapi 0.150 to 0.151
Breaking0.150.0 → 0.151.0Breaking2Fixed1
BreakingUpgrade verdict
2 breaking changes.
In plain terms
- If a client sends null for a body field, it is now treated as a real value instead of being replaced by the default. Nullable fields accept null; non-nullable fields reject it, even if they have a default.
- When the endpoint expects a JSON object, either because of Body(embed=True) or because there are multiple body parameters, sending null as the whole body is now rejected with a validation error.
Must act 2 items need code or config changes
What you must change
Breaking2
JSON request bodies now distinguish an explicit null from an omitted value for Body parameters.
BodySending null as the entire body now returns a validation error when a JSON object is expected.
Body