Class SchemaGenerator

java.lang.Object
graphql.schema.idl.SchemaGenerator

@PublicApi public class SchemaGenerator extends Object
This can generate a working runtime schema from a type registry and runtime wiring

The generator uses the RuntimeWiring to insert code that runs behind the schema elements such as DataFetchers, TypeResolvers and scalar Coercing.

The order of DataFetcher resolution is as follows:

  1. If the WiringFactory provides the DataFetcherFactory for a field in its parent type then that is used
  2. If the WiringFactory provides the DataFetcher for a field in its parent type then that is used
  3. If the RuntimeWiring provides the DataFetcher for a field in its parent type, then that is used
  4. If the RuntimeWiring provides a default DataFetcher for a fields parent type, then that is used
  5. If the WiringFactory provides a default DataFetcherFactory for any element then that is used
  6. If the GraphQLCodeRegistry.Builder.getDefaultDataFetcherFactory() provides a DataFetcherFactory for a value then that is used
  7. Finally a PropertyDataFetcher is used as a last resort for the field

The order of TypeResolver resolution is as follows:

  1. If the WiringFactory provides a TypeResolver then that is used
  2. If the TypeRuntimeWiring provides a TypeResolver then that is used

The order of GraphQLScalarType resolution is as follows:

  1. If the WiringFactory provides a GraphQLScalarType then that is used
  2. Otherwise RuntimeWiring.getScalars() is used