---
Validates Pydantic schema files for CamelModel pattern compliance and identifies anti-patterns.
/plugin marketplace add adelabdelgawad/full-stack/plugin install fastapi-patterns@full-stackValidate that a Pydantic schema file follows the CamelModel pattern.
When the user wants to check a schema file, read the file and verify:
CamelModel, not BaseModelalias_generator or Field(alias=...) for camelCasemodel_config = ConfigDict(from_attributes=True)snake_case for field namesCamelModel or another schema that doesBaseModel directlyalias_generator = to_camel (should be inherited from CamelModel)Field(alias="camelCase") (not needed with CamelModel)For file src/backend/api/schemas/users.py:
Checking: src/backend/api/schemas/users.py
Classes Found:
- UserBase(CamelModel) ..................... OK
- UserCreate(UserBase) ..................... OK (inherits via UserBase)
- UserResponse(UserBase) ................... OK
- LoginRequest(BaseModel) .................. ERROR: Should use CamelModel
Anti-patterns Found:
- Line 45: alias_generator = to_camel (remove - CamelModel handles this)
Summary: 1 error, 1 warning
If issues are found, suggest the fix:
# Before (WRONG)
from pydantic import BaseModel
class UserCreate(BaseModel):
user_name: str = Field(alias="userName")
# After (CORRECT)
from api.schemas._base import CamelModel
class UserCreate(CamelModel):
user_name: str # Auto-aliased to "userName" in JSON
Report all findings clearly with file locations and line numbers.