-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: validate and parse nested models properly with default_factory
#1712
fix: validate and parse nested models properly with default_factory
#1712
Conversation
PR pydantic#1504 introduced a regression by bypassing `populate_validators()`, which would skip the validation of children in nested models with `default_factory` closes pydantic#1710
Codecov Report
@@ Coverage Diff @@
## master #1712 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 21 21
Lines 3893 3895 +2
Branches 783 783
=========================================
+ Hits 3893 3895 +2
Continue to review full report at Codecov.
|
default_factory
default_factory
52ca25a
to
16e489b
Compare
Thanks for finding and fixing this so quickly! Is there anything we can do to help expedite a 1.6.1 patch release? This issue has some pretty far reaching complications for our software stack. |
thanks so much. This looks good, I've tweaked some of the tests and added another one, otherwise I think this is good to go, will merge once it passes and release a patch. |
Thanks so much @PrettyWood for solving this so quickly and to all those who reported it. I've just tagged a release, it should be available in pypi in a few minutes. Sorry for the slightly delay. |
PR pydantic#1712 introduced a regression for forward refs in `ModelField.prepare` as it would not return early for forward refs anymore. Optional fields would hence have `required` set to `True`. closes pydantic#1736
* fix: forward ref with nested models and optional fields PR #1712 introduced a regression for forward refs in `ModelField.prepare` as it would not return early for forward refs anymore. Optional fields would hence have `required` set to `True`. closes #1736 * test: skip python 3.6 as __future__.annotations is not defined
Change Summary
PR #1504 introduced a regression by bypassing
populate_validators()
,which would skip the validation and mess with parsing of nested models with
default_factory
Related issue number
closes #1710
closes #1717
closes #1722
Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details)