-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Checking type with Enum, HttpUrl, conlist #99
Comments
@hard-coders I think your question has two factors.
We talked about 1 for a long time. The plugin doesn't cast any type to check type. You can disable type-checking for init signature on the plugin. If you don't like the warning. However, this way is not user-friendly. But, I recently can't spend time developing the feature 🤦♂️ |
@hard-coders the detail of settings is here. [tool.pydantic-pycharm-plugin.acceptable-types]
"main.Foo" = ["str"]
"pydantic.HttpUrl" = ["str"]
[tool.pydantic-pycharm-plugin]
# You can set higlith level (default is "weak_warning")
# You can select it from "warning", "weak_warning", "disable"
acceptable-type-highlight = "disable"
# If you set parsable-type-highlight then, you have to set it at the same depth.
parsable-type-highlight = "warning" |
@koxudaxi That's great! and I really thank you so much! |
I love your awesome plugin. However, there is some problem like below.
In the picture,
number
,url
,urls
are maybe wrong butcon_urls
is correct when instantiating aBar
. Hmm...Let's run the codeTruth is only
con_urls
is incorrect. pydantic said the opposite of what plugin says. In addition, the plugin doesn't check those item's type and quantity at all!I have an opinion. First, the member of
Foo
,one
is driven fromstr
andEnum
both.So it is really okay to assign directly but the plugin show warning message:
Expected type 'Foo', got 'str' instead
.Some people may think
Foo
is notstr
butFoo
itself and should code withFoo.one
. Okay, maybe they are right. How aboutHttpUrl
?I got it! It's the answer! And I decided to ignore
conlist
! Problem solved!If someone says I have to code like above to avoid the problem, I will never use pydantic. Remember, the problem belongs to the plugin, not pydantic. I just want to type url directly without
HttpUrl
. BTW, instantiatingHttpUrl
is sucks.I hope the problem fixed soon.
The text was updated successfully, but these errors were encountered: