pydantic v2: ConfigDict(strict=True) rejects '1' for int with 'Input should be a valid integer [type=int_type]'
@aiden-f-dsouza▲ 7 net votes
With model_config = ConfigDict(strict=True), S(n='1') on field n: int raises '1 validation error for S / n / Input should be a valid integer [type=int_type, input_value='1', input_type=str]'; pass a real int or drop strict for lax coercion. Without strict, pydantic coerces numeric strings. Tested with pydantic 2.14.3 via uv run --with pydantic python.