I am trying to fetch users by user ids and my graphqls data is:
type Query {
getUsersById(ids: [string!]: [User]
}
type User{
name: String!
}
Assume the controller returns a response like below:
Not working code
@QueryMapping("getUsersById")
public ParallelFlux<User> getUserById(@Argument List<String> ids){
return repository.getParallelFluxUsersInfo(ids);
}
I am not expecting any workaround like return Flux only. I just wanted to check if we can return ParallelFlux as well or not. If yes, how to define the query? With above code, its throwing an error like below:
"Can't resolve value /getUsersById: type mismatch error, expected type List. DataFetchingException."
It works if I use Flux, like below.
Working code
@QueryMapping("getUsersById")
public Flux<User> getUserById(@Argument List<String> ids){
return repository.getFluxUsersInfo(ids); //It works
}