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: check only first sublevel for validators with each_item
#1991
Conversation
When using a validator with `each_item`, the items are all validated one by one. But if the items are also iterable the subitems would then be validated because the validator would be kept as it is. Now the validator passed to the items is changed and won't be propagated closes pydantic#1933
Codecov Report
@@ Coverage Diff @@
## master #1991 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 21 21
Lines 4199 4202 +3
Branches 854 855 +1
=========================================
+ Hits 4199 4202 +3
Continue to review full report at Codecov.
|
I'll reply on the issue. |
see #1933 (comment), let's update this to add |
3444e15
to
ce879ea
Compare
@samuelcolvin Glad you accepted the proposal! I added the things: List[Tuple[str, str]] would trigger the validation for each field of each tuple BUT things: List[tuple] would trigger the validation for each tuple (like the new behaviour) So I think the
WDYT? |
Sorry for the slow reply. I agree |
c0a4377
to
4fad457
Compare
Great glad we agree then! :) I removed the last few commits and just added the "breaking change" note with some basic explanation |
Change Summary
When using a validator with
each_item
, the items are all validatedone by one. But if an item is also iterable the subitems are then
validated because the validator is kept as it is.
Now the validator passed to the items is changed and won't be propagated
Related issue number
closes #1255
closes #1933
Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details)