Skip to content
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

null arguments being passed to mutate as kwargs #1151

Closed
daynejones opened this issue Mar 24, 2021 · 3 comments
Closed

null arguments being passed to mutate as kwargs #1151

daynejones opened this issue Mar 24, 2021 · 3 comments
Labels

Comments

@daynejones
Copy link

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.

@zbyte64
Copy link
Collaborator

zbyte64 commented Mar 24, 2021

Would be fixed with: graphql-python/graphene#1300

@lovetoburnswhen
Copy link

How are people getting around this? This impacts query filter arguments as well

@erikwrede
Copy link
Member

Fixed: graphql-python/graphene@19ebf08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants