Search in sources :

Example 1 with SchemaParserBuilder

use of graphql.kickstart.tools.SchemaParserBuilder in project micronaut-graphql by micronaut-projects.

the class GraphQLFactory method graphQL.

@Bean
@Singleton
public GraphQL graphQL(ToDoQueryResolver toDoQueryResolver, ToDoMutationResolver toDoMutationResolver, ToDoResolver toDoResolver) {
    // Parse the schema.
    SchemaParserBuilder builder = SchemaParser.newParser().file("schema.graphqls").resolvers(toDoQueryResolver, toDoMutationResolver, toDoResolver);
    // Create the executable schema.
    GraphQLSchema graphQLSchema = builder.build().makeExecutableSchema();
    // Return the GraphQL bean.
    return GraphQL.newGraphQL(graphQLSchema).build();
}
Also used : GraphQLSchema(graphql.schema.GraphQLSchema) SchemaParserBuilder(graphql.kickstart.tools.SchemaParserBuilder) Singleton(jakarta.inject.Singleton) Bean(io.micronaut.context.annotation.Bean)

Aggregations

SchemaParserBuilder (graphql.kickstart.tools.SchemaParserBuilder)1 GraphQLSchema (graphql.schema.GraphQLSchema)1 Bean (io.micronaut.context.annotation.Bean)1 Singleton (jakarta.inject.Singleton)1