ValidationError is raised when Pydantic rejects input during validation. Catch it to access a readable report describing the model, location, expected value, error type, and received input.
SettingsConfigDict configures Pydantic settings models through named options such as environment-variable prefixes and dotenv-file loading. It is used as model_config data on a settings class.
model_dump(by_alias=True) serializes a Pydantic model to a dictionary using configured field aliases as keys. Leave it false or unset to use Python attribute names.
model_config assigns a ConfigDict to a Pydantic model, controlling validation and schema behavior. Options include handling extra fields and enabling strict validation.
Enables aliased fields to accept input by their Python attribute names as well as their aliases. It defaults to false and is not recommended from Pydantic v2.11 onward because it will be deprecated in v3.
Set frozen=True to make a Pydantic model faux-immutable and generate a __hash__() method. Hashing is only possible when all attribute values are hashable.
The extra configuration controls how Pydantic handles input keys that are not declared model fields. Choose ignore, forbid, or allow; the default is ignore.
validate_assignment enables validation when fields are changed after a Pydantic model is created. It defaults to False, so post-construction assignments are otherwise not revalidated.
use_enum_values=True makes Pydantic populate enum fields with their underlying values rather than enum members. Optional enum defaults need validate_default=True for this conversion to apply.
Allows model fields to use ordinary Python classes that Pydantic does not know how to validate. When enabled, Pydantic checks the supplied value's instance type rather than validating the object's internals.
alias_generator is a ConfigDict option that derives field aliases from their names. A callable applies to both validation and serialization; AliasGenerator supports different rules for each.