Class SchemaMappingInspector
java.lang.Object
org.springframework.graphql.execution.SchemaMappingInspector
Inspect schema mappings on startup to ensure the following:
- Schema fields have either a
DataFetcher
registration or a corresponding Class property. DataFetcher
registrations refer to a schema field that exists.DataFetcher
arguments have matching schema field arguments.
Use methods of GraphQlSource.SchemaResourceBuilder
to enable schema
inspection on startup. For all other cases, use initializer()
as a
starting point or the shortcut inspect(GraphQLSchema, Map)
.
- Since:
- 1.2.0
- Author:
- Brian Clozel, Rossen Stoyanchev
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Strategy to resolve the Java class(es) for aGraphQLObjectType
, effectively the reverse ofTypeResolver
, for schema inspection purposes.static interface
Helps to configureSchemaMappingInspector
. -
Method Summary
Modifier and TypeMethodDescriptionPerform an inspection and create aSchemaReport
.Return an initializer to configure theSchemaMappingInspector
and perform the inspection.static SchemaReport
inspect
(GraphQLSchema schema, RuntimeWiring runtimeWiring) Check the schema againstDataFetcher
registrations, and produce a report.static SchemaReport
inspect
(GraphQLSchema schema, Map<String, Map<String, DataFetcher>> fetchers) Variant ofinspect(GraphQLSchema, RuntimeWiring)
with a map ofDataFetcher
registrations.
-
Method Details
-
getOrCreateReport
Perform an inspection and create aSchemaReport
. The inspection is one once only, during the first call to this method. -
inspect
Check the schema againstDataFetcher
registrations, and produce a report.- Parameters:
schema
- the schema to inspectruntimeWiring
- forDataFetcher
registrations- Returns:
- the created report
-
inspect
public static SchemaReport inspect(GraphQLSchema schema, Map<String, Map<String, DataFetcher>> fetchers) Variant ofinspect(GraphQLSchema, RuntimeWiring)
with a map ofDataFetcher
registrations.- Parameters:
schema
- the schema to inspectfetchers
- the map ofDataFetcher
registrations- Since:
- 1.2.5
-
initializer
Return an initializer to configure theSchemaMappingInspector
and perform the inspection.- Since:
- 1.3.0
-