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 and omitted attributes in InputObjects #112
Comments
Perhaps you could accomplish this using
then you could write:
achieving the desired goal within the bounds of the language specification. |
The primary issue here is that most environments do not distinguish between I think @will-weiss's suggestion is closer to what you want. To explicitly declare the things you are removing in a mutation. |
One change that I can make that should make working with APIs that treat null specially is to also omit the not set object properties on the internal value. |
Yes, the workaround is really nice. I got it going without problems, thanks a lot for the idea. Regarding the reason behind the spec, I understand better now - but it's a pity I can't use a cleaner API considering that I have JS on both client and server. On Tue, Aug 11, 2015 at 10:23 PM, Lee Byron notifications@github.com
|
These changes will go out in the next version release. |
I want to build a mutation to modify (let's be original) a ToDo object. My hypothetical ToDo object has three fields:
whatToDo
,notes
andassignee
, all of themGraphQLString
s. So I define an InputObject type with all three fields:My generic mutation will be like this:
Now let's assume I want to use this new mutation to do the following: "update the
whatToDo
field and set theassignee
field tonull
, leaving the rest (notes
) unchanged". I would love to write......that is: explicitly including
assignee: null
to nullify that attribute, and omittingnotes
to leave this attribute as it is. But unfortunately the spec (and @leebyron's Slack remark confirms it) saysnull
values can only be modeled by leaving the attribute out, colliding with my other semantic needs: omitting an attribute to just not touch it.Any chance the spec might support
null
as a valid literal value? (Otherwise: what other options are there to implement such a generic mutation?).The text was updated successfully, but these errors were encountered: