Detailed information on missing response fields #1348
Unanswered
viktorvsk-dualentry
asked this question in
Q&A
Replies: 1 comment 3 replies
-
I guess you should make you name to accept None values: class UserOut(Schema):
id: int
name: Optional[str] |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Consider the following example
Now imagine by some reason (a bug for example) some users names are
None
. We will get entire request failed and the output would be something like:The question is, what are the best practices to debug here? Because
0
inresponse.0
here means a position of the failing record in the resulting list. But we are actually interested in figuring out a Userid
in order to investigate why was its name set toNone
and being able to update it.The best of course would be to alter error message to:
But its probably too complicated to achieve, so maybe its possible to intercept this error and log entire response object before validation?
I've looked through the website, issues and discussions and haven't found anything similar. If its not possible to achieve right now, could you please point me roughly to the code responsible for handling errored responses so I would try to come up with a PR ?
Beta Was this translation helpful? Give feedback.
All reactions