- Add max_length constraints to all string fields in request schemas, matching DB column limits (title:255, description:5000, etc.) - Add min_length=1 to required name/title fields - Add ConfigDict(extra="forbid") to all request schemas to reject unknown fields (prevents silent field injection) - Add Path(ge=1, le=2147483647) to all integer path parameters across all routers to prevent integer overflow → 500 errors - Add max_length to TOTP inline schemas (code:6, mfa_token:256, etc.) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
18 lines
386 B
Python
18 lines
386 B
Python
from pydantic import BaseModel, ConfigDict, Field
|
|
from datetime import datetime
|
|
|
|
|
|
class TaskCommentCreate(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
content: str = Field(min_length=1, max_length=10000)
|
|
|
|
|
|
class TaskCommentResponse(BaseModel):
|
|
id: int
|
|
task_id: int
|
|
content: str
|
|
created_at: datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|