Interface GraphQlSource.SchemaResourceBuilder

All Superinterfaces:
GraphQlSource.Builder<GraphQlSource.SchemaResourceBuilder>
Enclosing interface:
GraphQlSource

public static interface GraphQlSource.SchemaResourceBuilder extends GraphQlSource.Builder<GraphQlSource.SchemaResourceBuilder>
GraphQlSource builder that relies on parsing schema definition files and uses a RuntimeWiring to create the underlying GraphQLSchema.
Since:
1.0.0
Author:
Rossen Stoyanchev
  • Method Details

    • schemaResources

      GraphQlSource.SchemaResourceBuilder schemaResources(Resource... resources)
      Add schema definition resources, typically ".graphqls" files, to be parsed and merged.
      Parameters:
      resources - resources with GraphQL schema definitions
      Returns:
      the current builder
    • configureTypeDefinitions

      GraphQlSource.SchemaResourceBuilder configureTypeDefinitions(TypeDefinitionConfigurer configurer)
      Customize the TypeDefinitionRegistry created from parsed schema files, adding or changing schema type definitions before the GraphQLSchema is created and validated.
      Parameters:
      configurer - the configurer to apply
      Returns:
      the current builder
      Since:
      1.2.0
    • configureRuntimeWiring

      Configure the underlying RuntimeWiring.Builder to register data fetchers, custom scalar types, type resolvers, and more.
      Parameters:
      configurer - the configurer to apply
      Returns:
      the current builder
    • defaultTypeResolver

      GraphQlSource.SchemaResourceBuilder defaultTypeResolver(graphql.schema.TypeResolver typeResolver)
      Configure the default TypeResolver to use for GraphQL interface and union types that don't have such a registration after applying RuntimeWiringConfigurers.

      By default this is set to ClassNameTypeResolver.

      Parameters:
      typeResolver - the TypeResolver to use
      Returns:
      the current builder
    • inspectSchemaMappings

      GraphQlSource.SchemaResourceBuilder inspectSchemaMappings(Consumer<SchemaReport> reportConsumer)
      Enable inspection of schema mappings to find unmapped fields and unmapped DataFetcher registrations. For more details, see SchemaReport and the reference documentation.
      Parameters:
      reportConsumer - a hook to inspect the report
      Returns:
      the current builder
      Since:
      1.2.0
    • inspectSchemaMappings

      GraphQlSource.SchemaResourceBuilder inspectSchemaMappings(Consumer<SchemaMappingInspector.Initializer> initializerConsumer, Consumer<SchemaReport> reportConsumer)
      Variant of inspectSchemaMappings(Consumer) with the option to initialize the SchemaMappingInspector, e.g. in order to assist with finding Java representations of GraphQL union member types and interface implementation types.
      Parameters:
      initializerConsumer - callback to initialize the SchemaMappingInspector
      reportConsumer - a hook to inspect the report
      Returns:
      the current builder
      Since:
      1.3.0
    • schemaFactory

      GraphQlSource.SchemaResourceBuilder schemaFactory(BiFunction<graphql.schema.idl.TypeDefinitionRegistry, graphql.schema.idl.RuntimeWiring, graphql.schema.GraphQLSchema> schemaFactory)
      Configure a function to create the GraphQLSchema from the given TypeDefinitionRegistry and RuntimeWiring. This may be used for federation to create a combined schema.

      By default, the schema is created with SchemaGenerator.makeExecutableSchema(graphql.schema.idl.TypeDefinitionRegistry, graphql.schema.idl.RuntimeWiring).

      Parameters:
      schemaFactory - the function to create the schema
      Returns:
      the current builder