Class GraphQLPluginBuilder

  • All Implemented Interfaces:

    
    public final class GraphQLPluginBuilder
    
                        

    Builds the GraphQL schema and the pieces the plugin needs to serve it. This is the only way to configure the plugin:

    config.registerPlugin(
        GraphQLPluginBuilder("/graphql")
            .addPackage("com.example.schema")
            .register(QueryExample())
            .build()
    )

    Both context factories are optional and default to an empty GraphQLContext. The @JvmOverloads is what makes new GraphQLPluginBuilder("/graphql") compile from Java, where Kotlin's default arguments do not exist. Java callers realistically use the defaults: GraphQLContextFactory.generateContext is a suspend function, which is not implementable from Java in practice.

    Note that since graphql-kotlin 6 the context is graphql-java's map-like GraphQLContext, so this class no longer carries a context type parameter (ADR-001).