Skip to content
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

Default value by variable for Field is not recognized #318

Closed
spacemanspiff2007 opened this issue Jun 18, 2021 · 3 comments
Closed

Default value by variable for Field is not recognized #318

spacemanspiff2007 opened this issue Jun 18, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@spacemanspiff2007
Copy link

Describe the bug
Default parameter for field that is passed by variable is not recognized

To Reproduce

from typing import Final

from pydantic import BaseModel, Field

VERSION: Final = 1


class MyModel(BaseModel):
    version = Field(VERSION, const=True)


MyModel()

grafik

Expected behavior
If I pass 1 directly it works as desired and no warning is shown.

Environments (please complete the following information):

  • PyCharm 2021.1.2 (Community Edition)
  • Plugin 0.3.3
  • pydantic 1.8.2
@koxudaxi koxudaxi added the bug Something isn't working label Jun 19, 2021
@koxudaxi
Copy link
Owner

@spacemanspiff2007
Thank you for creating this issue.
I will fix it.

@koxudaxi
Copy link
Owner

I believe this problem is resolved.

@spacemanspiff2007
Copy link
Author

Yes - thank you very much for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants