-
Notifications
You must be signed in to change notification settings - Fork 819
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
2.0 Bug: Mutations return the field type if output not supplied #585
Comments
I found this as well. I was able to "fix" it by making my mutation explicitly set import graphene
class TestMutation(grapheneMutation):
test = graphene.Int()
@classmethod
def mutate(cls, root, info, **kwargs):
return TestMutation() mutation{
testMutation{
test
}
}
Funny thing is the rest of the response had the correct data (in my case). I think Hope this helps, and if you would rather I make an independent issue I'd be happy to. TLDR: Default values are no longer |
Yea thats what I ended up doing to. I have a subclass of mutation that I use on all my mutations so it was relatively painless. I think that long term this needs to be fixed in the code base |
def test():
class CreateBlank(Mutation):
class Arguments:
name = String()
string = String()
integer = Int()
def mutate(self, info, **args):
return CreateBlank()
class Query(ObjectType):
a = String()
class MyMutation(ObjectType):
create_blank = CreateBlank.Field()
schema = Schema(query=Query, mutation=MyMutation)
result = schema.execute(''' mutation mymutation {
createBlank(name:"Peter") {
string
integer
}
}
''')
assert not result.errors
assert result.data == {
'createUser': {
'string': None,
'integer': None,
}
} I had some trouble figuring out where the problem is happening at. But I was able to create a test that illustrates the issue here. It's not a PR, but since I haven't found where to actually fix it, I'd rather get the test out there. Hopefully it can help someone who actually knows what they are doing fix the problem. |
Just fixed this in master. The issue was happening on both I also added tests so this issue is not repeated in the future :) |
You can reproduce by creating a simple mutation
When this mutation is ran the return for test will be
"test": "<graphene.types.scalars.String object at 0x108617a20>"
took me a while to figure out what was happening, I'll keep digging see if I can find the root cause. Anyone else running into this issue?
The text was updated successfully, but these errors were encountered: