File size: 303 Bytes
ef1ad9e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
from pydantic import BaseModel, validator
class PasswordSchema(BaseModel):
user_id: int
code: int
password: str
@validator('password')
def password_must_not_be_empty(cls, v):
if not v:
raise ValueError("Password cannot be empty")
return v
|