Skip to content

Commit 9d1b6c5

Browse files
committed
Fix type-checking when using deprecated FieldValidationInfo
1 parent a8fb1e3 commit 9d1b6c5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

‎python/pydantic_core/core_schema.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3909,6 +3909,9 @@ def general_plain_validator_function(*args, **kwargs):
39093909
'FieldWrapValidatorFunction': WithInfoWrapValidatorFunction,
39103910
}
39113911

3912+
if TYPE_CHECKING:
3913+
FieldValidationInfo = ValidationInfo
3914+
39123915

39133916
def __getattr__(attr_name: str) -> object:
39143917
new_attr = _deprecated_import_lookup.get(attr_name)

‎tests/test_typing.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ def foo(bar: str) -> None:
2323
...
2424

2525

26+
def validator_deprecated(value: Any, info: core_schema.FieldValidationInfo) -> None:
27+
...
28+
29+
2630
def validator(value: Any, info: core_schema.ValidationInfo) -> None:
2731
...
2832

0 commit comments

Comments
 (0)