Martin Brehovsky
11/03/2020, 11:36 PMdata
section in the response, only errors
. Is it possible to get a response which would give me values for fetcher who did not fail and errors for the fetchers which fail? Something like this:
{
"data": {
"item": {
"foo": "foo"
},
}
"errors": [
{
"message": "Exception while fetching data (error) : I wonder what happends",
"locations": [
{
"line": 5,
"column": 3
}
],
"path": [
"bar"
],
"extensions": {}
}
]
}
Shane Myrick
11/03/2020, 11:58 PMDataFetcherResult<*>
as the return type
https://expediagroup.github.io/graphql-kotlin/docs/schema-generator/execution/exceptions#returning-data-and-errorsMartin Brehovsky
11/04/2020, 12:11 AMShane Myrick
11/04/2020, 1:28 AMMartin Brehovsky
11/04/2020, 1:41 AMSpringDataFetcher
and overriding get
method to return a future:
override fun get(environment: DataFetchingEnvironment): Any? = when (val result = super.get(environment)) {
is Mono<*> -> result.toFuture()
else -> result
}
}
I’m wondering - would it be possible to extend this to do the conversion to DataFetcherResult right here?Shane Myrick
11/04/2020, 6:22 PMwillResolveMonad
hook to unwrap any types that you may have. But in the code it self you would still need to return either a CompletableFuture<DataFetcherResult<T>>
or DataFetcherResult<T>
https://expediagroup.github.io/graphql-kotlin/docs/schema-generator/execution/async-models#rxjavareactorMartin Brehovsky
11/04/2020, 6:46 PM