-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 parsing nested custom root type models #1253
Fix parsing nested custom root type models #1253
Conversation
370eaef
to
74fecb3
Compare
Codecov Report
@@ Coverage Diff @@
## master #1253 +/- ##
===========================================
- Coverage 100.00% 99.89% -0.11%
===========================================
Files 21 21
Lines 3666 3708 +42
Branches 718 731 +13
===========================================
+ Hits 3666 3704 +38
- Misses 0 2 +2
- Partials 0 2 +2
Continue to review full report at Codecov.
|
e625165
to
fd0a670
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we still don't have a test for nested root models like i put on the issue.
Otherwise LGTM.
Not sure which you mean. I do have the example |
There's still no explicit test for a custom root type as as the type of a custom root type: from pydantic import BaseModel
class Foo(BaseModel):
__root__: Dict[str, int]
class Bar(BaseModel):
__root__: Foo |
fd0a670
to
92a7e3d
Compare
@samuelcolvin I have no idea why anyone would want do that explicitly, but I've added a test covering it. |
thanks so much. |
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Change Summary
When validating fields that are pydantic models, if all else fails explicitly check if
__custom_root_type__
is true, and try toparse_obj
if it is.Related issue number
Fixes #1190.
Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details)