graphql-kotlin: Reactor - Flux and Mono can't get them to work at all
So I’ve been hammering away at this for a day and I can’t seem to get even basic queries to work with mono or flux.
Below is an example of a query to a user profile from the identity store. If I convert this into a future it works out of the box, but the moment I use a mono i get all my fields as null
{"data":{"currentUserProfile":{"firstname":null,"lastname":null,"username":null,"emailAddress":null}}}
And the query code:
@PreAuthorize("isAuthenticated()")
fun currentUserProfile(context: GraphQLSecurityContext): Mono<UserProfile> {
return context.securityContext.flatMap { sc ->
val details = sc.authentication.details as UserCredential
userIdentityService.findById(details.id).map { UserProfile.fromUserIdentity(it) }
}
I don’t seem to have a problem generating schema with mono. I have registered a monad hook, but it seems to do nothing.
Is there something I’m doing wrong? I know it does call the query method, but I can’t seem to figure out I get a null response.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 32 (5 by maintainers)
Anyway, thanks for the help.
Here is the code for anyone that wants it. Obviously a todo will be to add expression support:
Edit: Forgot the annotation
Example: