FastAPI请求体模型内的属性验证
钱满满 •
使用pydantic.Field
class UserModel(BaseModel):
username: str = Field(..., min_length=3)
description: Optional[str] = Field(None, max_lenght=128...