strawberry.ext.mypy_plugin PydanticModelField.to_argument error
Closed this issue · 2 comments
chrisemke commented
I think I'm having some issues with strawberry.ext.mypy_plugin when using a pydantic model to make my types
When I enable I get this error (image). If I disable it runs.
Describe the Bug
When I enable I get this error. If I disable it runs.
System Information
- Operating system: Linux
Using version ^0.224.1 for strawberry-graphql
Using version ^2.6.4 for pydantic
Using version ^0.0.16 for sqlmodel
Using version ^1.9.0 for mypy
Additional Context
this is the file showed in error:
from strawberry import auto, type
from strawberry.experimental.pydantic import type as pydantic_type
from database.models.brazil import Address, City, State
@pydantic_type(name='State', model=State)
class StateType:
name: auto
acronym: auto
@pydantic_type(name='City', model=City)
class CityType:
ibge: auto
name: auto
ddd: auto
@type(name='Coordinates')
class CoordinatesType:
latitude: float
longitude: float
altitude: float
@pydantic_type(name='Address', model=Address)
class AddressType:
zipcode: auto
city: CityType
state: StateType
neighborhood: auto
complement: auto
coordinates: CoordinatesType | None = None
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.
atatsu commented
I was experiencing this issue as well, however, since updating to strawberry 0.227.2 it appears to be resolved. Gave it a try after seeing the 0.226.2 release mention an update for the plugin to support pydantic >= 2.7.