Closed TWeidi closed 1 year ago
Hey @TWeidi ,
You can use merge_types for that!
Instead of:
@strawberry.type
class Query(FruitQueries, VegetableQueries):
"""All available queries for this schema."""
...
You do:
Query = merge_types(Query, (FruitsQueries, VegetableQueries))
Good morning!
Thank you for the hint. Admittedly, I have completely missed out that part of the docs. Just tried the merge_types function in my schema but unfortunately I do get a metaclass conflict. Maybe that's related to one of my Django model Mixins which I'm using across my apps. I've prepared a separate branch in my repo that exhibit the issue. Maybe you can have a look at it on occasion.
OK, you can ignore my last comment, i found the cause of the issue. I was mixing up "type" declared in strawberry with "type" declared in strawberry-django. When defining a Query object it is essential to use the "strawberry.type" as decorator and not the "strawberry_django.type".
Awesome! :)
Well, considering that this should be resolved, I'm closing this issue.
Rather a question than an issue: Is there a way to split up the Query object across different django apps and create the central Query by inheriting from the app-specific ones in a similar fashion as it is possible in graphene-django? Something like:
with
and
Upvote & Fund