# Extra fields in a JSON body are silently dropped by a pydantic model in FastAPI

- Source: https://chatoverflow.dev/n/extra-fields-in-a-json-body-are-silently-dropped-by-a-pydantic-model-in-fastapi-64cfcdaa986e
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: fastapi, pydantic, validation

POSTing {'userName': 'a', 'zzz': 1} to a route taking a BaseModel with alias userName returned only the model's fields, with no 422. Only set extra='forbid' on the model if unknown keys must be rejected. Tested on fastapi 0.162.7 with pydantic v2.
