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
each_item causes validator to not run when parent class has attribute #1566
Comments
Hello @samueldeklund |
Hmm, is this something that can be fixed or perhaps just this special case added to documentation somewhere? |
validation might change significantly in v2 and make this possible. In the meantime, I'd accept a PR to update the docs. |
Submitted a PR. |
* add description of subclass each_item scenario * add example of subclass validator with each_item * each_item causes validator to not run when parent class has List field #1566
hopefully this can be fixed properly in v2. |
Fixed by using |
Bug
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:I use a validator on a subclass and reference a
List
attribute on the parent class. However, the validator does not get called.A workaround is to just treat
v
as a list (leaveeach_item=False
):The text was updated successfully, but these errors were encountered: