strawberry icon indicating copy to clipboard operation
strawberry copied to clipboard

Mypy complains wrongly about to_pydantic when using a pydantic type that was converted with all_fields=True

Open thejaminator opened this issue 1 year ago • 0 comments

Describe the Bug

I introduced this bug in 0.118.0

class MyModel(BaseModel):
    item: str


@strawberry_from_pydantic(model=MyModel, all_fields=True
)
class StrawberryModel:
    ...

StrawberryModel(item).to_pydantic()
# mypy errors incorrectly

I should be able to fix it by infering that all_fields=True if there are no strawberry.auto declarations in the class

System Information

  • Operating system:
  • Strawberry version (if applicable):

Additional Context

thejaminator avatar Jul 14 '22 07:07 thejaminator