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 Summary
Modifier and TypeMethodDescriptionconfigureRuntimeWiring(RuntimeWiringConfigurer configurer) Configure the underlyingRuntimeWiring.Builderto register data fetchers, custom scalar types, type resolvers, and more.configureTypeDefinitions(TypeDefinitionConfigurer configurer) Customize theTypeDefinitionRegistrycreated from parsed schema files, adding or changing schema type definitions before theGraphQLSchemais created and validated.defaultTypeResolver(graphql.schema.TypeResolver typeResolver) Configure the defaultTypeResolverto use for GraphQL interface and union types that don't have such a registration afterapplyingRuntimeWiringConfigurers.inspectSchemaMappings(Consumer<SchemaMappingInspector.Initializer> initializerConsumer, Consumer<SchemaReport> reportConsumer) Variant ofinspectSchemaMappings(Consumer)with the option to initialize theSchemaMappingInspector, e.g.inspectSchemaMappings(Consumer<SchemaReport> reportConsumer) Enable inspection of schema mappings to find unmapped fields and unmappedDataFetcherregistrations.schemaFactory(BiFunction<graphql.schema.idl.TypeDefinitionRegistry, graphql.schema.idl.RuntimeWiring, graphql.schema.GraphQLSchema> schemaFactory) Configure a function to create theGraphQLSchemafrom the givenTypeDefinitionRegistryandRuntimeWiring.schemaResources(Resource... resources) Add schema definition resources, typically ".graphqls" files, to beparsedandmerged.Methods inherited from interface org.springframework.graphql.execution.GraphQlSource.Builder
build, configureGraphQl, exceptionResolvers, graphQlSourceFactory, instrumentation, subscriptionExceptionResolvers, typeVisitors, typeVisitorsToTransformSchema
-
Method Details
-
schemaResources
Add schema definition resources, typically ".graphqls" files, to beparsedandmerged.- Parameters:
resources- resources with GraphQL schema definitions- Returns:
- the current builder
-
configureTypeDefinitions
Customize theTypeDefinitionRegistrycreated from parsed schema files, adding or changing schema type definitions before theGraphQLSchemais created and validated.- Parameters:
configurer- the configurer to apply- Returns:
- the current builder
- Since:
- 1.2.0
-
configureRuntimeWiring
Configure the underlyingRuntimeWiring.Builderto register data fetchers, custom scalar types, type resolvers, and more.- Parameters:
configurer- the configurer to apply- Returns:
- the current builder
-
defaultTypeResolver
Configure the defaultTypeResolverto use for GraphQL interface and union types that don't have such a registration afterapplyingRuntimeWiringConfigurers.By default this is set to
ClassNameTypeResolver.- Parameters:
typeResolver- theTypeResolverto use- Returns:
- the current builder
-
inspectSchemaMappings
Enable inspection of schema mappings to find unmapped fields and unmappedDataFetcherregistrations. For more details, seeSchemaReportand 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 ofinspectSchemaMappings(Consumer)with the option to initialize theSchemaMappingInspector, e.g. in order to assist with finding Java representations of GraphQL union member types and interface implementation types.- Parameters:
initializerConsumer- callback to initialize theSchemaMappingInspectorreportConsumer- 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 theGraphQLSchemafrom the givenTypeDefinitionRegistryandRuntimeWiring. 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
-