Check that all Pydantic schemas inherit from CamelModel
Scans schema files for Pydantic BaseModel usage and reports CamelModel compliance violations.
/plugin marketplace add adelabdelgawad/full-stack/plugin install camelmodel-enforcement@full-stackIMPORTANT: When this command is invoked, you MUST actually SCAN the codebase and REPORT findings. Do NOT just describe what to check.
Use Glob to find all schema files:
{backend}/api/schemas/*.py
{backend}/api/http_schema/*.py
Look for classes that inherit from BaseModel:
class SomethingSchema(BaseModel): # ❌ Should use CamelModel
For each Pydantic model class, verify it inherits from:
CamelModel - CorrectBaseModel (from pydantic) - Wrongpydantic.BaseModel - WrongVerify file imports CamelModel:
from api.http_schema.base_schema import CamelModel # ✅ Correct
FORMAT YOUR OUTPUT EXACTLY LIKE THIS:
╔══════════════════════════════════════════════════════════════╗
║ CAMELMODEL ENFORCEMENT REPORT ║
╚══════════════════════════════════════════════════════════════╝
📋 FILES CHECKED
────────────────────────
✅ user_schema.py - All schemas use CamelModel
✅ role_schema.py - All schemas use CamelModel
❌ order_schema.py - Uses BaseModel directly
📊 VIOLATIONS FOUND
────────────────────────
order_schema.py:
Line 5: from pydantic import BaseModel ❌
Line 12: class OrderCreate(BaseModel): ❌
Line 25: class OrderUpdate(BaseModel): ❌
Line 38: class OrderResponse(BaseModel): ❌
📊 SUMMARY
────────────────────────
Files compliant: 8/10
Classes violating: 4
🔧 REQUIRED FIXES
────────────────────────
1. order_schema.py:
- Replace: from pydantic import BaseModel
- With: from api.http_schema.base_schema import CamelModel
- Change all class inheritance from BaseModel to CamelModel
If violations are found, ask: "Would you like me to fix the CamelModel violations?"
If user agrees, for each file:
from pydantic import BaseModel with from api.http_schema.base_schema import CamelModel(BaseModel) to (CamelModel) in class definitionspydantic importsfrom api.http_schema.base_schema import CamelModel
class UserCreateSchema(CamelModel):
first_name: str # Serializes as "firstName" in JSON
last_name: str # Serializes as "lastName" in JSON
CamelModel automatically converts:
snake_case → JSON camelCase (serialization)camelCase → Python snake_case (deserialization)This ensures consistency with frontend JavaScript/TypeScript conventions.
This command MUST:
BaseModel usageDO NOT just tell the user to run a script. PERFORM THE CHECK.