From 99f501e748fb0f59946214334af7d9907f262408 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sat, 13 Dec 2025 16:31:47 -0600 Subject: [PATCH] Fix custom command creator POST validation (v2.3.1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed CustomCommandCreatorModel.id from required `int` to `Optional[int] = None` to allow POST requests to create new creators without specifying an ID (database auto-generates it). Bug: Users couldn't create custom commands with /new-cc - API returned 422 error "Field required" for missing id field. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- CLAUDE.md | 1 + VERSION | 2 +- app/routers_v3/custom_commands.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index efbc93e..542521c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -72,6 +72,7 @@ app/ - **Models**: Pydantic models for request/response validation - **Database Access**: Direct Peewee ORM queries with automatic connection pooling - **Response Format**: Consistent JSON with proper HTTP status codes +- **POST Requests**: Pydantic models for POST (create) endpoints should use `Optional[int] = None` for `id` fields since the database auto-generates IDs ### Environment Variables **Required**: diff --git a/VERSION b/VERSION index 276cbf9..2bf1c1c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3.0 +2.3.1 diff --git a/app/routers_v3/custom_commands.py b/app/routers_v3/custom_commands.py index bff9900..c6e8fca 100644 --- a/app/routers_v3/custom_commands.py +++ b/app/routers_v3/custom_commands.py @@ -20,7 +20,7 @@ router = APIRouter( # Pydantic Models for API class CustomCommandCreatorModel(BaseModel): - id: int + id: Optional[int] = None # Optional for POST (auto-generated), required on response discord_id: int username: str display_name: Optional[str] = None