Description
- What is the current behavior?
Currently explicitly supplying null value in a mutation query and leaving out a field & its value resulted in the same {'field': None}
value in the mutate
function, instead of what was described by @jkimbo in #103
- If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via
a github repo, https://repl.it or similar (you can use this template as a starting point: https://repl.it/@jkimbo/Graphene-Django-Example).
Say this is my schema:
type UserType {
id: ID!
name: String!
phone: String!
}
This is the UserMutation
defined in schema.py
:
class MediatorMutation(graphene.Mutation):
class Arguments:
id = graphene.ID(required=True)
name = graphene.String()
phone = graphene.String()
user = graphene.Field(UserType)
def mutate(self, info, **args):
print(args)
return UserMutation(user=user)
This is my mutation query:
mutation {
updateUser(id: 1, phone: null){
user {
id
name
phone
}
}
}
- What is the expected behavior?
I expect the print line to be {'id': '1', 'phone': None}
, but it's currently printing {'id': '1', 'name': None, 'phone': None}
- What is the motivation / use case for changing the behavior?
This is important for updating when we want to set a nullable field to null/None. See relevant GraphQL spec change: graphql/graphql-spec#83
-
Please tell us about your environment:
- Version: graphene-django==3.0.0b7
- Platform: macos
-
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)
I just want to hear maintainer & community's thoughts on this and if it's just a user issue on my end. Happy to send a patch/PR once we confirm this is indeed a bug.