You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@ContextValue does not work for Mono argument #355
When an @SchemaMapping annotated controller method has a parameter that is annotated with @ContextValue and whose type is Mono, it will be called with null when the corresponding value in the GraphQLContext is an empty Mono.
When the GraphQLContext contains a mapping from value to Mono.empty(), the below code will throw an NPE:
I believe the cause is in InvocableHandlerMethodSupport.toArgsMono(Object[] args). This code replaces empty Mono instances in the generated arguments list with null if they are empty. This works fine for unwrapping Mono values stored in the GraphQLContext for an annotated controller with a @ContextValue parameter whose type is the Mono's element type, such as a Mono<String> value in the context to a String (or null) parameter value, but is an issue with a Mono parameter type since it gets invoked with null.
Edit:
This is the code that replaced the empty Mono with null regardless of the @ContextValue parameter type:
changed the title [-]Annotated controller method @ContextValue parameter called with null for empty Mono in GraphQLContext despite parameter type being Mono[/-][+]@ContextValue does not work for Mono argument[/+]on May 5, 2022
Activity
[-]Annotated controller method @ContextValue parameter called with null for empty Mono in GraphQLContext despite parameter type being Mono[/-][+]@ContextValue does not work for Mono argument[/+]Support Mono argument with @ContextValue