diff --git a/spring-graphql/src/main/java/org/springframework/graphql/execution/SchemaMappingInspector.java b/spring-graphql/src/main/java/org/springframework/graphql/execution/SchemaMappingInspector.java index ed753fba..b7f6e2e0 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/execution/SchemaMappingInspector.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/execution/SchemaMappingInspector.java @@ -34,6 +34,8 @@ import graphql.schema.GraphQLScalarType; import graphql.schema.GraphQLSchema; import graphql.schema.GraphQLType; import graphql.schema.idl.RuntimeWiring; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.BeansException; @@ -71,6 +73,9 @@ import org.springframework.util.MultiValueMap; */ class SchemaMappingInspector { + private static final Log logger = LogFactory.getLog(SchemaMappingInspector.class); + + private final GraphQLSchema schema; private final RuntimeWiring runtimeWiring; @@ -132,11 +137,19 @@ class SchemaMappingInspector { if (!(type instanceof GraphQLFieldsContainer fieldContainer)) { if (isNotScalarOrEnumType(type)) { + if (logger.isDebugEnabled()) { + logger.debug("Skipped '" + getTypeName(type) + "': " + + "inspection does not support " + type.getClass().getSimpleName() + "."); + } this.reportBuilder.addSkippedType(getTypeName(type)); } return; } else if (resolvableType != null && resolveClassToCompare(resolvableType) == Object.class) { + if (logger.isDebugEnabled()) { + logger.debug("Skipped '" + getTypeName(type) + "': " + + "inspection could not determine the Java object return type."); + } this.reportBuilder.addSkippedType(getTypeName(type)); return; } @@ -152,6 +165,10 @@ class SchemaMappingInspector { inspectType(field.getType(), selfDescribingDataFetcher.getReturnType()); } else if (isNotScalarOrEnumType(field.getType())) { + if (logger.isDebugEnabled()) { + logger.debug("Skipped '" + getTypeName(field.getType()) + "': " + + fetcher.getClass().getName() + " does not implement SelfDescribingDataFetcher."); + } this.reportBuilder.addSkippedType(getTypeName(field.getType())); } } diff --git a/spring-graphql/src/test/java/org/springframework/graphql/execution/SchemaMappingInspectorTests.java b/spring-graphql/src/test/java/org/springframework/graphql/execution/SchemaMappingInspectorTests.java index 899a763f..446a14f6 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/execution/SchemaMappingInspectorTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/execution/SchemaMappingInspectorTests.java @@ -34,7 +34,6 @@ import org.springframework.data.domain.OffsetScrollPosition; import org.springframework.data.domain.Window; import org.springframework.graphql.Author; import org.springframework.graphql.Book; -import org.springframework.graphql.GraphQlSetup; import org.springframework.graphql.data.method.annotation.Argument; import org.springframework.graphql.data.method.annotation.MutationMapping; import org.springframework.graphql.data.method.annotation.QueryMapping; @@ -423,7 +422,7 @@ class SchemaMappingInspectorTests { } """; - GraphQLSchema schema = GraphQlSetup.schemaContent(schemaContent).toGraphQlSource().schema(); + GraphQLSchema schema = SchemaGenerator.createdMockedSchema(schemaContent); RuntimeWiring wiring = RuntimeWiring.newRuntimeWiring() .type("Query", builder -> builder.dataFetcher("bookById", environment -> null)) .build(); @@ -440,7 +439,7 @@ class SchemaMappingInspectorTests { } """; - GraphQLSchema schema = GraphQlSetup.schemaContent(schemaContent).toGraphQlSource().schema(); + GraphQLSchema schema = SchemaGenerator.createdMockedSchema(schemaContent); RuntimeWiring wiring = RuntimeWiring.newRuntimeWiring() .type("Query", builder -> builder.dataFetcher("greeting", environment -> null)) .build();