'Graphql SPQR how to represent undefined fields

So I was reading this https://github.com/leangen/graphql-spqr/issues/197 and we have

    mutation createUser {
  createUser(name: "Test", address: null) {
    ...
  }
}

defined with this code

@GraphQLMutation
public User createUser(String name, Optional<Address> address) { ... }

as the way to say "Create a user with a name of Test and an undefined address" (ie do not overwrite the value of address in the database). Which is backwards, but we can't do anything about that for weird Jackson/Java reasons.

But what if I have

   mutation createUser{
createUser(User: {name: "Test", address: null}){
...
}
}

defined with this code

@GraphQLMutation
public User createUser(User user) { ... }

Where a User object has a Name and an Address.

Is there a way to make this work?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source