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
Hello all, I have been stuck on this problem and can't figure out how to resolve it.
I am using the StrawberrySQLAlchemyMapper to create my strawberry classes based on my ORM classes. It all works fine until I reach a table which is polymorphic.
And then the query I execute in the playground is the following:
query MyQuery { getPurchaseById(filter: {id: "334dbb48-31b8-4d18-a9c0-123d7be7a17c"}) { id createdBy Items { edges { node { id status TemplateItem { id name description } } } } } }
I get the following error and I cannot figure out how to resolve it:
graphql.error.graphql_error.GraphQLError: Abstract type 'TemplateItemsORMInterface' must resolve to an Object type at runtime for field 'ItemORM.ItemTemplate'. Either the 'TemplateItemsORMInterface' type should provide a 'resolve_type' function or each possible type should provide an 'is_type_of' function.
I have tested the query inside getPurchaseById, and the sqlalchemy query returns the what I am expecting.
I havent been able to figure out where and how to define these resolve_type or is_type_of functions. Any help is aprpeciated!
The text was updated successfully, but these errors were encountered:
Hello all, I have been stuck on this problem and can't figure out how to resolve it.
I am using the StrawberrySQLAlchemyMapper to create my strawberry classes based on my ORM classes. It all works fine until I reach a table which is polymorphic.
These are my ORM classes:
Then I create the related strawberry classes using strawberry StrawberrySQLAlchemyMapper as follows:
And then the query I execute in the playground is the following:
query MyQuery { getPurchaseById(filter: {id: "334dbb48-31b8-4d18-a9c0-123d7be7a17c"}) { id createdBy Items { edges { node { id status TemplateItem { id name description } } } } } }
I get the following error and I cannot figure out how to resolve it:
graphql.error.graphql_error.GraphQLError: Abstract type 'TemplateItemsORMInterface' must resolve to an Object type at runtime for field 'ItemORM.ItemTemplate'. Either the 'TemplateItemsORMInterface' type should provide a 'resolve_type' function or each possible type should provide an 'is_type_of' function.
I have tested the query inside getPurchaseById, and the sqlalchemy query returns the what I am expecting.
I havent been able to figure out where and how to define these resolve_type or is_type_of functions. Any help is aprpeciated!
The text was updated successfully, but these errors were encountered: