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

(🐞) false positive with Final attribute in RootModel #990

Open
KotlinIsland opened this issue Sep 24, 2024 · 1 comment
Open

(🐞) false positive with Final attribute in RootModel #990

KotlinIsland opened this issue Sep 24, 2024 · 1 comment

Comments

@KotlinIsland
Copy link
Contributor

KotlinIsland commented Sep 24, 2024

from typing import Final

from pydantic import RootModel


class Model(RootModel[str]):
    a: Final = 1  # Unexpected field with name a; only 'root' is allowed as a field of a `RootModel` 

Final with a default is not a field, it's an attribute

@skewty
Copy link

skewty commented Oct 15, 2024

Perhaps this is just a case of Final not being treated similar to ClassVar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants