graphql-over-http
graphql-over-http copied to clipboard
GraphQL request optional parameters
Request parameter section currently specifies
Note: Specifying null in JSON (or equivalent values in other formats) as values for optional request parameters is equivalent to not specifying them at all.
I believe the above is incorrect as there is a semantic difference between
- this parameter has a
null
(aka explicitly defined) value
vs
- this parameter is not specified (aka undefined)
We had few requests for this functionality in graphql-kotlin
(e.g. https://github.com/ExpediaGroup/graphql-kotlin/issues/783) and support it since the 4.x release. TLDR this is similar to undefined
vs null
value in Javascript (or wrapping value/null value in Optional
in Java).
@dariuszkuc We're talking about the direct values of request parameters here (query
, operationName
, variables
, extensions
), not argument/input field values during GraphQL execution. It's saying that:
{
query: "{__typename}",
operationName: null,
variables: null,
extensions: null
}
is equivalent to:
{
query: "{__typename}"
}
Gotcha. Thanks for clarifying.