-
-
Notifications
You must be signed in to change notification settings - Fork 2
bug: inventory add endpoint requires 'name' and 'item_type' but frontend sends 'item_name' — always 422 #721
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingfrontendFrontend/UXFrontend/UXgame-engineGame mechanics/rulesGame mechanics/rulespriority:highShould fix soonShould fix soon
Description
Summary
POST /inventory/{character_id}/add returns 422 because the frontend sends item_name but the backend Pydantic model requires name and additionally requires item_type:
{"detail": [
{"type": "missing", "loc": ["body", "name"], "msg": "Field required"},
{"type": "missing", "loc": ["body", "item_type"], "msg": "Field required"}
]}The frontend InventoryItem interface uses name (correct), but wherever items are constructed from predefined character data they use item_id as the primary identifier (see #620). Additionally the item_type field has no default value and is required, but is not present in the frontend InventoryItem interface.
This means the entire inventory management system is broken — no items can be added.
Files
backend/app/api/routes/inventory_routes.py— inventory add modelfrontend/src/services/api.ts—InventoryIteminterface missingitem_type
Fix
Either add item_type with a sensible default (e.g., 'misc') to the Pydantic model, or make it optional.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfrontendFrontend/UXFrontend/UXgame-engineGame mechanics/rulesGame mechanics/rulespriority:highShould fix soonShould fix soon