-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query & Mutation in namespaces #627
Comments
Hi @axieum , What is the use case for those namespaces? TBH I have seen someone mentioning something similar, but never saw that anywhere. Also, is that a strawberry-django issue or a general strawberry issue? |
Hi @bellini666 👋 It appears to just affect strawberry-django fields. I was not able to reproduce when using pure strawberry fields. There's a reproduction repository linked at the bottom of the issue which shows the strawberry-django namespacing issue. Thanks, |
I've the same issue. A workaround seems to set create, update, delete... to something: @strawberry.type
class Mutation:
@strawberry.field(description="Mutate fruits")
def fruits(self) -> FruitMutation:
return FruitMutation(create=None, update=None, delete=None) |
This looks to work for mutations 😄, but I can't get it to work for a query. @strawberry.field(description="Query fruits")
def fruits(self) -> FruitQuery:
return FruitQuery(all=None) It raises a |
Update; this works for nested queries. @strawberry.field(description="Query fruits")
def fruits(self) -> FruitQuery:
return FruitQuery(all=Fruit.__strawberry_django_definition__.model.objects) I am unsure of the implications of providing a queryset here. And this for nested mutations. @strawberry.field(description="Mutate fruits")
def fruits(self) -> FruitMutation:
return FruitMutation(create=None, update=None, delete=None) Related to #580 (comment) |
Describe the Bug
As per the documentation, https://strawberry.rocks/docs/general/mutations#nested-mutations
Raises
FruitMutation.__init__() missing 3 required keyword-only arguments: 'create', 'update', and 'delete'
I also tried the following variant to no avail.
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:
This does not work:
Query fields cannot be resolved. Argument type must be a GraphQL input type.
System Information
Additional Context
Here is a reproduction repo: https://github.com/axieum/django-strawberry-example
Upvote & Fund
The text was updated successfully, but these errors were encountered: