-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X
Description
Bug
Please complete:
- OS: Ubuntu 19.04
- Python version
import sys; print(sys.version): 3.7.3 - Pydantic version
import pydantic; print(pydantic.VERSION): 1.0
With the code found in the root validators documentation:
from pydantic import BaseModel, root_validator
class UserModel(BaseModel):
username: str
password1: str
password2: str
@root_validator(pre=True)
def check_card_number_omitted(cls, values): # type: ignore
assert 'card_number' not in values, 'card_number should not be included'
return valuesMypy 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_validatorMetadata
Metadata
Assignees
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X