You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Attempting to use a non-existing field does not get marked as a warning when using pydantic v2.
To Reproduce
Ensure "Python | Type checker compatible with Pydantic", "Python | Pydantic definition and usages", and "Python | Unresolved references" inspections are configured to level warning.
NOTE: I also tried disabling them one at a time, and it did not make a difference.
NOTE: There is no such inspection "Type Checker" any more, so I cannot disable it.
Actual behavior a.fake generates an unresolved reference warning, but b.fake does not show any warning.
Expected behavior b.fake should be flagged as unresolved reference, non-existing attribute, or similar warning.
Screenshots
Environments (please complete the following information):
IDE: PyCharm 2023.3.1 (Professional Edition)
OS: macOS 12.7.1
Pydantic Version 2.5.2
Python Version 3.12.1 (also tried with 3.9.x)
Plugin version 0.4.10
Additional context
Also reproduced on CLion Nova with the Python Community Edition plugin 233.13309
I also tried:
Uninstalling and re-installing pydantic
"Repair IDE" (all the way to Invalidate Caches and Restart)
Switching the import to from pydantic.v1 import BaseModel fixes the issue.
The text was updated successfully, but these errors were encountered:
oleg-rmd
changed the title
Attempting to use a non-existing model field is not detected as a problem.
Attempting to use a non-existing model field is not detected as a problem in pydantic v2
Dec 19, 2023
Describe the bug
Attempting to use a non-existing field does not get marked as a warning when using pydantic v2.
To Reproduce
Actual behavior
a.fake
generates an unresolved reference warning, butb.fake
does not show any warning.Expected behavior
b.fake
should be flagged as unresolved reference, non-existing attribute, or similar warning.Screenshots
![image](https://private-user-images.githubusercontent.com/50600269/291739661-fc344e34-0c1b-488b-8445-0ee432e862ee.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg5NDU4MzEsIm5iZiI6MTcxODk0NTUzMSwicGF0aCI6Ii81MDYwMDI2OS8yOTE3Mzk2NjEtZmMzNDRlMzQtMGMxYi00ODhiLTg0NDUtMGVlNDMyZTg2MmVlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIxVDA0NTIxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRhYTEzZGI0N2RhZjNkMjg3MDk5NmQ0MmFlNzUyMGM0ZDQ4ODc1MDk4NjhmNDlhNjFiMjkxZTE4ZDY3NGI0MjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Xn44FXNZMUGTKsdaxVL3pdV4YFgmkU6MnyE4AWqIwzo)
Environments (please complete the following information):
Additional context
Also reproduced on CLion Nova with the Python Community Edition plugin 233.13309
I also tried:
Switching the import to
from pydantic.v1 import BaseModel
fixes the issue.The text was updated successfully, but these errors were encountered: