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
I'm updating graphql-spring-boot-starter and graphql-java-tools from version 6.0.1 to version 13.0.0.
In the code, we're manually adding resolvers through GraphQLSchema as outlined in this issue - #293
@Configuration
public class GraphQLConfig {
@Autowired
AutowiredResolver1 autowiredResolver1;
@Autowired
AutowiredResolver2 autowiredResolver2;
...
@Bean
public SchemaParser schemaParser() {
return SchemaParser.newParser()
.file("my-schema.graphqls")
.options(SchemaParserOptions.newBuilder().preferGraphQLResolver(true).build()
.resolvers(autowiredResolver,autowiredResolver2,...)
.build();
}
}
I can't figure out how to do the same in v13.0 unfortunately as it seems like the only option is to add each of the Query/Mutation's methods manually to RuntimeWiring as SchemaParser only parses schema. Is there any other way to set my resolvers that I'm missing?
@Bean
public GraphQLSchema schema() {
TypeDefinitionRegistry typeRegistry = new SchemaParser().parse("schema.json");
RuntimeWiring wiring = buildRuntimeWiring();
GraphQLSchema schema = new SchemaGenerator().makeExecutableSchema(typeRegistry, wiring);
return schema;
}
private RuntimeWiring buildRuntimeWiring() {
return RuntimeWiring.newRuntimeWiring()
.type(
TypeRuntimeWiring.newTypeWiring("Mutation").typeResolver(mutationResolver.create())
// defining all the types
.build();
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm updating graphql-spring-boot-starter and graphql-java-tools from version 6.0.1 to version 13.0.0.
In the code, we're manually adding resolvers through GraphQLSchema as outlined in this issue - #293
I can't figure out how to do the same in v13.0 unfortunately as it seems like the only option is to add each of the Query/Mutation's methods manually to RuntimeWiring as SchemaParser only parses schema. Is there any other way to set my resolvers that I'm missing?
Beta Was this translation helpful? Give feedback.
All reactions