-
Notifications
You must be signed in to change notification settings - Fork 826
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
Self parameter is None in mutate method #810
Comments
I bet we are doing something wrong here, @symstu . |
First off, I am using graphene-django, so this might be totally unrelated. |
This also seems to apply to |
I also experience some frustrations with this and I think this is intended. I remember I saw a discussion in another issue related on this and the conclusion was that this design was deliberately implemented like this but I don't remember the justification and I can't seem to find the issue right now. I think this is a very poor design choice as it doesn't allow any OOP principle to be applied for mutations and queries as I can't access any method or member. What's the point of using classes if you can't use OOP principles anyway? |
What is the rationale for unbinding mutate @syrusakbary ? graphene/graphene/types/mutation.py Line 66 in 08c86f3
Edit: the commit that unbounded mutate: 999bca8 |
Any explanation here? |
I think the rationale is that the Mutation class is not a traditional class. Instead serves only as a description of a mutation. I also think the unbounded mutate was to fix a bug. 🤷🏻♂️ |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Commenting to unstale. This design should be improved, or strongly documented with workarounds/suggestions (and workaround implications). |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still a valid issue |
It's not a issue. it is intended, grahpene documents help me to understand how it works. |
Whether it's intended is not the issue, the issue is what's right. :) This behavior breaks convention, reduces functionality, and smells like over-engineering. |
The intended behavior here makes no sense. The point of a library like If I wanted the function signatures to be exactly the same as Apollo, I'd use Apollo. Please reinstate |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is still a valid open issue. |
This has bitten me now as well. This is an unpython and confusing design choice. |
This is still a valid issue. Has there been any justification for the design? |
I've created a proposal for an alternative API for mutations that should solve this issue: #1226 Feedback welcome! |
still seeing this |
Just got hit by this, wasted 15 minutes. |
So, what`s the solution? How to get a self variable? |
This is nothing short of a poor design choice. I have been working around this on the resolver side for a sizable graphql api, now hit by the same issue with mutations. Cant even do something a simply OO as get an inherited variable from a base class. |
Just ran into this issue and found this thread via Google search. I'd be interested in learning more about the design decisions around this as its causing some awkward workarounds in my project. |
This is still an issue. |
Same here, I want to put a method in my Mutation class that is not allowed, so, my mutation will be really a long one, def mutate(self, info, id, input):
foovar=do_something()
self._do_something_else() # self is None
return SomeResponse(foo=foovar)
def _do_something_else((self):
return "Hi world" |
In terms of OOP in my class I'm able to workaround this by using I'm wondering if perhaps |
I don't know, maybe it's not a bug and problem caused by rx, but i have this mutation
and wrote such decorator
I wait for UserLogin object in self argument of mutation method, but it's equal None. Info is equal ResolveObject. When i wraps mutate method with
@classmethod
decorator, i got UserLogin login class,info
is None and appears third position required argument which is actually isinfo
.Any ideas?
The text was updated successfully, but these errors were encountered: