strawberry icon indicating copy to clipboard operation
strawberry copied to clipboard

Better pyright support for pydantic conversion

Open thejaminator opened this issue 2 years ago • 5 comments

Makes sense, do you think we can also add this? https://github.com/strawberry-graphql/strawberry/blob/main/strawberry/object_type.py#L152-L153 this should make it work slightly better with pyright

does that work out of the box for the pydantic conversion? not familar with how that works but i think the init for the dataclass wouldn't work well because not all the fields are in the class getting decorated.

e.g.

class UserCreate(BaseModel):
    email: str


@strawberry.experimental.pydantic.input(model=UserCreate, all_fields=True)
class UserCreateInput:
    pass # the fields aren't here

if it doesn't and gives false positives i'll settle it in another issue

it only works with fields that are defined, so yeah, let's do it in another issue :)

Originally posted by @patrick91 in https://github.com/strawberry-graphql/strawberry/issues/1832#issuecomment-1105318146

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

thejaminator avatar Apr 21 '22 14:04 thejaminator