null arguments being passed to mutate as kwargs
class UpdateThing(graphene.Mutation):
class Arguments:
guid = graphene.UUID(required=True)
selector = graphene.String()
note = graphene.String()
Output = Thing
def mutate(root, info, guid, **kwargs):
print(kwargs)
placement_rule = ThingAPI.update_thing(
guid=guid,
selector=selector,
note=note,
)
return thing
Query:
mutation {
updateThing(
guid: "foo", selector: ".test") {
note
}
}
print(kwargs) prints the following:
{"guid": "foo", "selector": ".test", "note": None}
As a result, I have no idea whether note was omitted or if a null value was passed in. According to the docs, kwargs should contain only the arguments that were actually passed in. Hopefully I'm crazy and there's something I'm missing or some other canonical way of achieving what I want. Thanks for the help.
Would be fixed with: https://github.com/graphql-python/graphene/pull/1300
How are people getting around this? This impacts query filter arguments as well
Fixed: https://github.com/graphql-python/graphene/commit/19ebf08339263f0446235ddffbbab0e6d3f11699