You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by brucegodden November 25, 2024
I am working on a GraphQL mutation for updating an object. I would like to say:
if an input property is not set then the object value is left alone;
if an input property is set then the object value is set to that value;
except that if the property is specified as null then the object value is cleared. (Only makes sense for optional properties, of course.)
This seems to me to be a reasonable GraphQL API definition. It is fairly straightforward to arrange to obey this behaviour in the implementation of the API.
However, the generated API client does not seem to distinguish between not set and null. Either you have to set a value in the constructor for the input type, presumably null if you don't have an actual value, or the value defaults to null if you don't explicitly set it.
Would it be unreasonable to ask for the generated client to be able to arrange to not include a property in the query input if the user did not specify a value for it? (Possibly only for optional properties.)
To cause further confusion, it looks like the conversion from the input type to the query input is ignoring any properties set to null, whether explicitly or not. (A common behaviour of Jackson and its ilk.)
The text was updated successfully, but these errors were encountered:
Discussed in #2074
Originally posted by brucegodden November 25, 2024
I am working on a GraphQL mutation for updating an object. I would like to say:
This seems to me to be a reasonable GraphQL API definition. It is fairly straightforward to arrange to obey this behaviour in the implementation of the API.
However, the generated API client does not seem to distinguish between not set and null. Either you have to set a value in the constructor for the input type, presumably null if you don't have an actual value, or the value defaults to null if you don't explicitly set it.
Would it be unreasonable to ask for the generated client to be able to arrange to not include a property in the query input if the user did not specify a value for it? (Possibly only for optional properties.)
To cause further confusion, it looks like the conversion from the input type to the query input is ignoring any properties set to null, whether explicitly or not. (A common behaviour of Jackson and its ilk.)
The text was updated successfully, but these errors were encountered: