Skip to content

bug: inventory add endpoint requires 'name' and 'item_type' but frontend sends 'item_name' — always 422 #721

@Sealjay

Description

@Sealjay

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 model
  • frontend/src/services/api.tsInventoryItem interface missing item_type

Fix

Either add item_type with a sensible default (e.g., 'misc') to the Pydantic model, or make it optional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions