Repository navigation
π Fix response_model not invalidating None - #2725
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2725 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 533 533
Lines 13725 13746 +21
=========================================
+ Hits 13725 13746 +21
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
π Docs preview for commit 2ba3e03 at: https://6014892c3c6551478a242c75--fastapi.netlify.app |
|
I don't think this is going to be accepted. It introduces a breaking change. π |
|
I agree with @Kludex, but this idea can be evaluated something like: response_model_skip_validation: bool = FalseBy implementing something like this we can also be able to skip the response validation, and we will still have documentation for that object in our OpenAPI schema. |
response_model not invalidating Noneresponse_model not invalidating None
|
π Docs preview for commit 0c7bd64 at: https://6303d11c7228b7149ae22e88--fastapi.netlify.app |
Oh me from the past, this comment is not very useful! Glad you learned over time! π |
|
Thanks for the contribution @hukkin! π And thanks for the input @Kludex and @ycd! π€ I'll make sure I make a bump in the version as this will be a potentially breaking change. This makes sense, as This will be available in FastAPI |
|
π Docs preview for commit 0eb4cef at: https://6303d4de86981b181826f072--fastapi.netlify.app |
FastAPI doesn't validate `None` when handler has specified
a response model. Fix the below validation error for GET node by ID
and GET group by ID requests:
```
{"detail":"1 validation error for UserGroup\nresponse\n none
is not an allowed value (type=type_error.none.not_allowed)"}
```
The change has been effective from `fastapi 0.80.0` version.
Reference: fastapi/fastapi#2725.
Signed-off-by: Jeny Sadadia <jeny.sadadia@collabora.com>
FastAPI doesn't validate `None` when handler has specified
a response model. Fix the below validation error for GET node by ID
and GET group by ID requests:
```
{"detail":"1 validation error for UserGroup\nresponse\n none
is not an allowed value (type=type_error.none.not_allowed)"}
```
The change has been effective from `fastapi 0.80.0` version.
Reference: fastapi/fastapi#2725.
Signed-off-by: Jeny Sadadia <jeny.sadadia@collabora.com>
FastAPI doesn't validate `None` when handler has specified
a response model. Fix the below validation error for GET node by ID
and GET group by ID requests:
```
{"detail":"1 validation error for UserGroup\nresponse\n none
is not an allowed value (type=type_error.none.not_allowed)"}
```
The change has been effective from `fastapi 0.80.0` version.
Reference: fastapi/fastapi#2725.
Signed-off-by: Jeny Sadadia <jeny.sadadia@collabora.com>
FastAPI doesn't validate `None` when handler has specified
a response model. Fix the below validation error for GET node by ID
and GET group by ID requests:
```
{"detail":"1 validation error for UserGroup\nresponse\n none
is not an allowed value (type=type_error.none.not_allowed)"}
```
The change has been effective from `fastapi 0.80.0` version.
Reference: fastapi/fastapi#2725.
Signed-off-by: Jeny Sadadia <jeny.sadadia@collabora.com>
Related to #2719