micronaut-graphql
micronaut-graphql copied to clipboard
Support @Refreshable
Feature description
I am generating the the GraphQL schema at runtime and I'd wish to update the schema when an external modification is made.
Preferably I'd like to use the @Refreshable annotation as that is what is used elsewhere and can easily be triggered via a REST end-point.
e.g
@Bean
@Refreshable
public GraphQL graphQL() {
...
}
Unfortunately this is not possible currently due to GraphQL missing a default constructor.
As a work-around I was able to achieve it by using
@Bean
@Replaces(GraphQLInvocation.class)
@Refreshable
public GraphQLInvocation graphQLInvocation(GraphQL graphQL,
GraphQLExecutionInputCustomizer graphQLExecutionInputCustomizer,
@Nullable BeanProvider<DataLoaderRegistry> dataLoaderRegistry) {
return new DefaultGraphQLInvocation(graphQL, graphQLExecutionInputCustomizer, dataLoaderRegistry);
}