-
Notifications
You must be signed in to change notification settings - Fork 828
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
Confusing documentation on self argument of mutate method of Mutations #951
Comments
Hey @allardhoeve, thanks for your question! The first argument of In practice, root is always In theory, one can set any value that you want as
I'm going to take a stab at making the documentation for both Mutation and Query resolvers more clear with a PR soon. |
PR #969 is up to address this (and several other documentation concerns. |
#969 has been merged |
Hi there,
The documentation on Mutations is a little confusing about the arguments the
mutate
method of aMutation
receives. Two examples list the method as:This is actually incorrect, as the
mutate
method is always a@staticmethod
, because the resolver is unbound here in graphene/types/mutation.py.This is documented further on as:
I would like to document this better in this part of the documentation, because it has caused me a lot of time to figure this out and would like to spare other that effort.
Can you elaborate on when
root
is set and what it will contain? I've only seen cases whereroot
isNone
.Also, can you elaborate on why you chose to make the resolver method
mutate
a static method by default? It being a static method makes it hard to implement inheritance betweenMutation
classes.Finally, how would I go about having a resolver method that is NOT a static method if I wanted to? The code suggests I could use
Meta
attributes to do so, but the documentation does not tell me how. I would like to add that to the documentation.Edit: The resolvers always being a
staticmethod
is documented here, but you have to first know thatdef mutate
is considered a resolver and also you'd have to really remember that.Thanks
The text was updated successfully, but these errors were encountered: