Pydantic validations for extra fields that not defined in schema
Pydantic v2 You can use the extra field in the model_config class attribute to forbid extra attributes during model initialisation (by default, additional attributes will be ignored). For example: