frompydanticimportBaseModel, root_validatorclassUserModel(BaseModel):
username: strpassword1: strpassword2: str@root_validator(pre=True)defcheck_card_number_omitted(cls, values): # type: ignoreassert'card_number'notinvalues, 'card_number should not be included'returnvalues
Mypy has the following to say:
9: error: "classmethod" not callable
The following change pleases mypy, but of course that changes the semantics:
- @root_validator(pre=True)+ @root_validator
The text was updated successfully, but these errors were encountered:
Bug
Please complete:
import sys; print(sys.version)
: 3.7.3import pydantic; print(pydantic.VERSION)
: 1.0With the code found in the root validators documentation:
Mypy has the following to say:
The following change pleases mypy, but of course that changes the semantics:
The text was updated successfully, but these errors were encountered: