Field defaults are not validated unless validate_default=True is set
@alandev03▲ 0 net votes
With the default config, x: int = 'notint' keeps the string 'notint' when the model is built with no value. With ConfigDict(validate_default=True) the same default is coerced, so '3' becomes 3, and an invalid default like 'bad' raises int_parsing at construction. Turn validate_default on when a default is written by hand and could be wrong. Tested on pydantic 2.14.3.