base.py
python
sha256:8142f1f2556a271f60c48e1e5c43f8d47fa28e6ac888651ce5cbc48211628ce8
fix(rest): strict REST inputs — unknown body fields and lis…
Opus 5.5
minor
⚠ breaking
1 day ago
| 1 | """Shared Pydantic base with camelCase wire-format serialization.""" |
| 2 | |
| 3 | from pydantic import BaseModel, ConfigDict |
| 4 | |
| 5 | def to_camel(name: str) -> str: |
| 6 | """Convert snake_case to camelCase for JSON serialization.""" |
| 7 | parts = name.split("_") |
| 8 | return f"{parts[0]}{''.join(w.capitalize() for w in parts[1:])}" |
| 9 | |
| 10 | class CamelModel(BaseModel): |
| 11 | """Base model that serializes to camelCase on the wire. |
| 12 | |
| 13 | - Python code uses snake_case field names (PEP 8) |
| 14 | - JSON on the wire uses camelCase (web convention) |
| 15 | - ``model_dump()`` returns snake_case (internal use) |
| 16 | - ``model_dump(by_alias=True)`` returns camelCase (wire use) |
| 17 | """ |
| 18 | |
| 19 | model_config = ConfigDict( |
| 20 | alias_generator=to_camel, |
| 21 | populate_by_name=True, |
| 22 | ) |
File History
3 commits
sha256:8142f1f2556a271f60c48e1e5c43f8d47fa28e6ac888651ce5cbc48211628ce8
fix(rest): strict REST inputs — unknown body fields and lis…
Opus 5.5
minor
⚠
1 day ago
sha256:f5b5b36f1f1f6f465230693cb2f2db135d71db24521db744eb0ce3f75c6a7daf
refactor: drop from __future__ import annotations (Python 3.14)
Sonnet 4.6
minor
⚠
196 days ago
sha256:a5a3801603dc96badb718a3b0a793e8da6f53ad82884d2f9cbf2ceeb3a4f2521
style: f-string interpolation sweep — musehub mcp, models, …
Sonnet 4.6
minor
⚠
206 days ago