You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
graphene_pydantic.converters.ConversionError: Don't know how to convert the Pydantic field ModelField(name='address', type=Optional[TAddress], required=False, default=None) (<class 'app.address.serializers.TAddress'>)
It seems like that there is a problem when using pydantic models from different modules that depends on each other.
What is the solution for this use case?
Any idea?
The text was updated successfully, but these errors were encountered:
You have to declare also TAddress as a PydanticObjectType class.
models are located in directory schemas
schemas/taddress.py
schemas/tuser.py
grapql_models are located in graphql_models
graphql_models/models.py
from app import schemas
class TAddress(PydanticObjectType):
class Meta:
model = schemas. TAddress
class TUser(PydanticObjectType):
class Meta:
model = schemas.TUser`
Use Case Scenario
I've two pydantic models. Each in his own module (file). One Model, the TUser depends on the TAddress.
address_model.py
user_model.py
If I use the TUser model know for my PydanticObjectType
I get the following error message:
It seems like that there is a problem when using pydantic models from different modules that depends on each other.
What is the solution for this use case?
Any idea?
The text was updated successfully, but these errors were encountered: