Prior to this commit, error handling methods would support various
arguments, including the exception being handled.
Our reference documentation would advise to create a new instance of a
`GraphQLError` using `GraphQLError.newError()`. This does not initialize
the location and path information of the current error.
This commit allows error handling methods to get injected with a
`GraphQlErrorBuilder<?>` argument that is initialized with the current
`DataFetchingEnvironment` (thus filling the location and path parts).
Fixes gh-1200
ContextDataFetcherDecorator was not retaining extensions for DataFetchers returning
a DataFetcherResult instance.
Closes gh-1199
Signed-off-by: Patrick Strawderman <pstrawderman@netflix.com>
[brian.clozel@broadcom.com: apply code conventions]
Signed-off-by: Brian Clozel <brian.clozel@broadcom.com>
Prior to this commit, a WebSocket/SSE client disconnecting from the data
stream would cause a CANCEL signal to be sent to upstream publishers.
This signal would flow from the transport layer up to the
`ExecutionGraphQlService`. Because the `GraphQL` engine itself relies on
`CompletableFuture`, the CANCEL signal would not flow through and
reactive data fetchers would not receive it. This means that costly
reactive operations would not be cancelled and this could cause write
failures as publishers would still produce values.
This commit adds at the service level a Reactor `Sink` to the
`GraphQLContext` that can be picked up by the
`ContextDataFetcherDecorator` when decorating reactive data fetchers.
This allows us to manually cancel publishers when the CANCEL signal is
received at the transport level.
Fixes gh-1149
Prior to this commit, the `ExecutionGraphQlService` would throw
`GrahphQLException` instances if errors happen early in the process, for
example in some cases of document parsing/validation.
Such exception would be thrown directly and not reflected in the GraphQL
response if those are `GraphQLError`.
This commit ensures that a fallback GraphQL response is created in this
case and that it contains the relevant `GraphQLError` information.
Fixes gh-1118
We now flatten argument maps to ensure keys in the resulting
parameter map are fully-qualified property paths.
Previously, we built a parameter map containing nested maps
leading to invalid queries.
Closes gh-1085