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
{{ message }}
Repository navigation
Absence of Optional arguments are represented with Optional.empty() instead of null #1586
Accordingly to graphql/graphql-spec#83 there is a distinction of null and absence of value in fields and arguments.
In graphql-java (using with the spring boot package) an Optional field respects that, i.e., absence sets the field to Java null and GraphQL null sets the field to Optional.empty().
However, in method arguments absence of value sets the Optional argument to Optional.empty(), not allowing to distinguish it from explicit GraphQL null.
Can you outline in more details what you would expect to happen for Optional argument values.
The graphql-java "argument and validation" code we written on Java 6 originally (hence no optional).
Hence it does use Optional well. The "field value" optional work was added much later.
The other question I have is around how you see "http requests of say json" being able to produce optional arguments versus null ones. json conversion is not a direct graphql-java concern - however if we end up with Optional argument code that no framework can produce inputs for then it wont be useful.
I expect the same that happen with Optional input fields inside classes
mapped to graphql input types: explicit nulls becomes Optional.empty and
absent values becomes Java null.
Are you using a library built on top of graphql-java. We do no mapping of java classes to to input types is why I ask?
I know we don;t have code to handle Optional inside out argument parsing code (I am not arguing that) but I want to get a better understanding of your runtime.
For example are you using the kickstart spring starters or some other Java -> graphql library framework?
@asfernandes I think this is the wrong project: we are not setting any fields to null/optional.
Please report it to the spring booter/graphql java tools project.
Activity
bbakerman commentedon Jul 13, 2019
Can you outline in more details what you would expect to happen for Optional argument values.
The graphql-java "argument and validation" code we written on Java 6 originally (hence no optional).
Hence it does use Optional well. The "field value" optional work was added much later.
The other question I have is around how you see "http requests of say json" being able to produce optional arguments versus null ones. json conversion is not a direct graphql-java concern - however if we end up with
Optionalargument code that no framework can produce inputs for then it wont be useful.asfernandes commentedon Jul 14, 2019
bbakerman commentedon Jul 15, 2019
Are you using a library built on top of graphql-java. We do no mapping of java classes to to input types is why I ask?
I know we don;t have code to handle Optional inside out argument parsing code (I am not arguing that) but I want to get a better understanding of your runtime.
For example are you using the kickstart spring starters or some other Java -> graphql library framework?
asfernandes commentedon Jul 15, 2019
Yes, I'm using the spring boot starter (which also uses graphql-java-tools).
andimarek commentedon Jul 18, 2019
@asfernandes I think this is the wrong project: we are not setting any fields to null/optional.
Please report it to the spring booter/graphql java tools project.
Thanks.