graphql-kotlin-schema-generator provides a single function,
toSchema, to generate a schema from Kotlin objects. This
function accepts four arguments: config, queries, mutations and subscriptions.
The queries, mutations and subscriptions are a list of TopLevelObjects and will be used to generate corresponding GraphQL root types.
contains all the extra information you need to pass, including custom hooks, supported packages and name overrides.
SchemaGeneratorConfig has some default settings but you can override them and add custom behaviors for generating your
supportedPackages[Required] - List of Kotlin packages that can contain schema objects. Limits the scope of packages that can be scanned using reflections.
topLevelNames[Optional] - Set the name of the top level GraphQL fields, defaults to
hooks[Optional] - Set custom behaviors for generating the schema, see below for details.
dataFetcherFactory[Optional] - Sets custom behavior for generating data fetchers
introspectionEnabled[Optional] - Boolean flag indicating whether introspection queries are enabled, introspection queries are enabled by default
additionalTypes[Optional] - Set of additional GraphQL types to include when generating the schema.
Hooks are lifecycle events that are called and triggered while the schema is building that allow users to customize the schema.
As an example here is how you would write a custom hook and provide it through the configuration
Notice there is no