-
-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue for extra fields not appearing in the errors #845
Conversation
This PR actually fixes another issue as well: when u have Schema as attribute for another schema:
and you send this json
Django ninja reports that schema is correct, however after the change in this pr we get the correct error that we missed before
|
well it's not that easy (as you see from failed tests) I think there must be some trick so that pydantic thinks DjangoGetter is a dict |
Hi @nofalx regarding - |
Hi, Please use black on your code |
@vitalik turns out the logic does not depend on the I dont understand the inners of pydantic very well but I have tested the update code in a django projects and all scenarios seem to be working fine for root of the json and nested json shema we using for the API. The projects tests are all passing as well |
c391a9e
to
efb7311
Compare
Added new test cases to cover the issues this pr fixed. Code now passes lint and tests |
9512e52
to
18f3ebc
Compare
There might be also development on pydantic side for this: pydantic/pydantic#5434 will check if that covers this case as well |
Hi @vitalik Looks like a better approach, hope this makes it to next beta |
Solves Issue #835
Reference for impact of this change:
https://docs.pydantic.dev/latest/usage/validators/#model-validators