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

Absence of Optional arguments are represented with Optional.empty() instead of null #294

Closed
asfernandes opened this issue Jul 19, 2019 · 2 comments · Fixed by #310, #315 or #316
Closed

Comments

@asfernandes
Copy link

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.

@asfernandes
Copy link
Author

The issue was originally created in graphql-java/graphql-java#1586

@vojtapol
Copy link
Member

vojtapol commented Sep 3, 2019

This was a surprise to us too. The workaround is to pass in DataFetchingEnvironment and then call DataFetchingEnvironment::containsArgument.

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