As per the documentation, https://strawberry.rocks/docs/general/mutations#nested-mutations
@strawberry.type
class Query:
@strawberry.field(description="Query fruits")
def fruits(self) -> FruitQuery:
return FruitQuery()
@strawberry.type
class Mutation:
@strawberry.field(description="Mutate fruits")
def fruits(self) -> FruitMutation:
return FruitMutation()
Raises FruitMutation.__init__() missing 3 required keyword-only arguments: 'create', 'update', and 'delete'
I also tried the following variant to no avail.
@strawberry.type
class Query:
fruits: FruitQuery= strawberry.field(resolver=FruitQuery, description="Query fruits")
@strawberry.type
class Mutation:
fruits: FruitMutation = strawberry.field(resolver=FruitMutation, description="Mutate fruits")
Raises Query fields cannot be resolved
The only thing that appears to be correct, is the GraphiQL schema, in all scenarios it is correct - but that would be due to the type hinting I assume.
This works:
from . import models
from .types import Fruit
@strawberry.type
class FruitQuery:
@strawberry_django.connection(ListConnectionWithTotalCount[Fruit])
def all(self) -> list[models.Fruit]:
return models.Fruit.objects.all()
This does not work:
@strawberry.type
class FruitQuery:
all: ListConnectionWithTotalCount[Fruit] = strawberry_django.connection()
Query fields cannot be resolved. Argument type must be a GraphQL input type.
Here is a reproduction repo: https://github.com/axieum/django-strawberry-example
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too