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

Does not mark unresolved references for optional inner models #927

Open
chbndrhnns opened this issue Apr 22, 2024 · 1 comment
Open

Does not mark unresolved references for optional inner models #927

chbndrhnns opened this issue Apr 22, 2024 · 1 comment

Comments

@chbndrhnns
Copy link

Describe the bug
Missing warning for unresolved reference.

To Reproduce

from typing import Optional

from pydantic import BaseModel


class Inner(BaseModel):
    id: int
    name: str


class Outer(BaseModel):
    inner: Optional[Inner] = None


def test_():
    actual = Outer()
    assert actual.other
    assert actual.inner.other

Expected behavior
PyCharm points out that other is no field on inner.
Compare with actual.other where the unresolved reference is triggering a warning.

Screenshots
Screenshot 2024-04-22 at 13 38 57

Environments (please complete the following information):

  • IDE: PyCharm 2024.1.1
  • OS: macOS 14.4.1
  • Pydantic Version 2.7.0
  • Plugin version 0.4.13

Additional context
Add any other context about the problem here.

@chbndrhnns chbndrhnns changed the title Does not mark unresolved references for beyond the root model Does not mark unresolved references for optional inner models Apr 22, 2024
@chbndrhnns
Copy link
Author

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

1 participant