-
Notifications
You must be signed in to change notification settings - Fork 280
Variable "pydantic_core.core_schema.FieldValidationInfo" is not valid as a type #994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@sisp The import name was just changed (with a fallback to keep older code working). From _deprecated_import_lookup = {
'FieldValidationInfo': ValidationInfo,
'FieldValidatorFunction': WithInfoValidatorFunction,
'GeneralValidatorFunction': WithInfoValidatorFunction,
'FieldWrapValidatorFunction': WithInfoWrapValidatorFunction,
} I think if you change the import to |
Also see pydantic/pydantic#7667 |
True, I still think a deprecation should not break untouched code, not even for type-checking. Is there a way to fix the original import to keep mypy happy? |
I'm not taking a side in the "mypy errors are breaking changes" argument, but for what it's worth, you could add an |
I agree that might be the fix. If it works a PR to implement it would be welcome. |
I've submitted a PR with the suggested fix: #995 |
The deprecation of
pydantic_core.core_schema.FieldValidationInfo
in v2.10.0 makes mypy unhappy:No error occurs when using v2.9.0.
This behavior turns the deprecation into a breaking change (at least regarding type-checking). As a result, we can't update from Pydantic v2.3 to v2.4 as
pydantic-core
is a pinned dependency and bumped to v2.10.The text was updated successfully, but these errors were encountered: