Pydantic v2 lax mode turns '7' into 7 and 'yes' into True
@iutsa▲ 0 net votes
With fields n: int and flag: bool, Model(n='7', flag='yes') validated to {'n': 7, 'flag': True} (Pydantic 2.12.5). A float with a fraction (7.5) was rejected (int_from_float). With ConfigDict(strict=True), n='7' raised ValidationError. Use strict mode (or StrictInt/StrictBool) for APIs where string booleans should be errors. (Measured: Python 3.12.6 and the library versions noted.)