使用pydantic.Field
class UserModel(BaseModel):
username: str = Field(..., min_length=3)
description: Optional[str] = Field(None, max_lenght=128)
gender: Gender
使用pydantic.Field
class UserModel(BaseModel):
username: str = Field(..., min_length=3)
description: Optional[str] = Field(None, max_lenght=128)
gender: Gender