I am trying to write datafetcher for Flux in similar fashion as Mono and used the below code to return a CompletableFuture, but this always returns null.? HOw to support Flux in graphql expediagroup
class CustomFunctionDataFetcher(target: Any?, fn: KFunction<*>) : FunctionDataFetcher(target, fn) {
override fun get(environment: DataFetchingEnvironment): Any? = when (val result = super.get(environment)) {
is Mono<*> -> result.toFuture()
is Flux<*> -> result.map { it -> Mono.just(it).toFuture() }.collect(Collectors.toList()).toFuture()
else -> result
}
}