Enhancement: allow route handlers to return None
if return_dto
is set without configuring partial
#3428
Labels
Enhancement
This is a new feature or request
Summary
Refer to the example below.
A route handler annotated to return
Data | None
, along withreturn_dto=DataDTO
being set will raiseAttributeError
ifNone
is returned - if the DTO configpartial
attribute isFalse
. The same goes for returning an empty dict, except this will raise aKeyError
instead.A workaround is to define a duplicate DTO with
partial
setTrue
.Basic Example
Drawbacks and Impact
This enhancement might cause issues for users following this pattern and actively catching attribute or key errors. People are crazy.
Unresolved questions
No response
Note
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.
Check out all issues funded or available for funding on our Polar.sh dashboard
The text was updated successfully, but these errors were encountered: