You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See relevant quote from documentation about current behavior:
Field validation will not occur if pre=True root validators raise an error. As with field validators, "post" (i.e. pre=False) root validators will be called even if field validation fails; the values argument will be a dict containing the values which passed field validation and field defaults where applicable. From https://pydantic-docs.helpmanual.io/usage/validators/
Thank you all for developing this library!
The text was updated successfully, but these errors were encountered:
Implemented on #1050. I thought about using the Validator class, but that'd require many changes (right now in the flow @samuelcolvin mentioned the validator config are removed and only functions are left).
The alternative was to add a variable to the function itself, which is what I chose to do.
Another approach which we'll require more coding will change model.post_root_validators and the pre one contain the f_cls instead of only functions. @samuelcolvin What do you think? Should I go for the other approach or this one suffices?
Feature Request
Please complete:
import sys; print(sys.version)
: 3.7import pydantic; print(pydantic.VERSION)
: 1.1.1If field validation fails there often is no need to call root validator as it will fail too because fields are not available.
I suggest that new parameter is added to
root_validator
decorator that disables call of root_validator if field validation failed.@root_validator(pre=False, call_on_field_failure=False)
See relevant quote from documentation about current behavior:
Thank you all for developing this library!
The text was updated successfully, but these errors were encountered: