@@ -220,14 +220,15 @@ else if (typePair.outputType() instanceof GraphQLInterfaceType interfaceType) {
220220// Can we inspect GraphQL type?
221221if (!(graphQlType instanceof GraphQLFieldsContainer fieldContainer )) {
222222if (isNotScalarOrEnumType (graphQlType )) {
223- this .reportBuilder .skippedType (graphQlType , parent , field , "Unsupported schema type" );
223+ this .reportBuilder .skippedType (graphQlType , parent , field , "Unsupported schema type" , false );
224224}
225225continue ;
226226}
227227
228228// Can we inspect the Class?
229229if (currentResolvableType .resolve (Object .class ) == Object .class ) {
230- this .reportBuilder .skippedType (graphQlType , parent , field , "No class information" );
230+ boolean isDerived = !graphQlType .equals (typePair .outputType ());
231+ this .reportBuilder .skippedType (graphQlType , parent , field , "No class information" , isDerived );
231232continue ;
232233}
233234
@@ -723,7 +724,9 @@ private final class ReportBuilder {
723724
724725private final MultiValueMap <DataFetcher <?>, String > unmappedArguments = new LinkedMultiValueMap <>();
725726
726- private final List <SchemaReport .SkippedType > skippedTypes = new ArrayList <>();
727+ private final List <DefaultSkippedType > skippedTypes = new ArrayList <>();
728+
729+ private final List <DefaultSkippedType > candidateSkippedTypes = new ArrayList <>();
727730
728731void unmappedField (FieldCoordinates coordinates ) {
729732this .unmappedFields .add (coordinates );
@@ -737,19 +740,44 @@ void unmappedArgument(DataFetcher<?> dataFetcher, List<String> arguments) {
737740this .unmappedArguments .put (dataFetcher , arguments );
738741}
739742
740- void skippedType (GraphQLType type , GraphQLFieldsContainer parent , GraphQLFieldDefinition field , String reason ) {
741- DefaultSkippedType skippedType = DefaultSkippedType .create (type , parent , field );
743+ void skippedType (
744+ GraphQLType type , GraphQLFieldsContainer parent , GraphQLFieldDefinition field ,
745+ String reason , boolean isDerivedType ) {
746+
747+ DefaultSkippedType skippedType = DefaultSkippedType .create (type , parent , field , reason );
748+
749+ if (!isDerivedType ) {
750+ skippedType (skippedType );
751+ return ;
752+ }
753+
754+ // Keep skipped union member or interface implementing types aside to the end.
755+ // Use of concrete types elsewhere may provide more information.
756+
757+ this .candidateSkippedTypes .add (skippedType );
758+ }
759+
760+ private void skippedType (DefaultSkippedType skippedType ) {
742761if (logger .isDebugEnabled ()) {
743- logger .debug ("Skipping '" + skippedType + "': " + reason );
762+ logger .debug ("Skipping '" + skippedType + "': " + skippedType . reason () );
744763}
745764this .skippedTypes .add (skippedType );
746765}
747766
748767SchemaReport build () {
768+
769+ this .candidateSkippedTypes .forEach ((skippedType ) -> {
770+ if (skippedType .type () instanceof GraphQLFieldsContainer fieldsContainer ) {
771+ if (SchemaMappingInspector .this .inspectedTypes .contains (fieldsContainer .getName ())) {
772+ return ;
773+ }
774+ }
775+ skippedType (skippedType );
776+ });
777+
749778return new DefaultSchemaReport (
750779this .unmappedFields , this .unmappedRegistrations , this .unmappedArguments , this .skippedTypes );
751780}
752-
753781}
754782
755783
@@ -768,7 +796,7 @@ private final class DefaultSchemaReport implements SchemaReport {
768796
769797DefaultSchemaReport (
770798List <FieldCoordinates > unmappedFields , Map <FieldCoordinates , DataFetcher <?>> unmappedRegistrations ,
771- MultiValueMap <DataFetcher <?>, String > unmappedArguments , List <SkippedType > skippedTypes ) {
799+ MultiValueMap <DataFetcher <?>, String > unmappedArguments , List <DefaultSkippedType > skippedTypes ) {
772800
773801this .unmappedFields = Collections .unmodifiableList (unmappedFields );
774802this .unmappedRegistrations = Collections .unmodifiableMap (unmappedRegistrations );
@@ -834,17 +862,18 @@ private String formatUnmappedFields() {
834862 * Default implementation of a {@link SchemaReport.SkippedType}.
835863 */
836864private record DefaultSkippedType (
837- GraphQLType type , FieldCoordinates fieldCoordinates ) implements SchemaReport .SkippedType {
865+ GraphQLType type , FieldCoordinates fieldCoordinates , String reason )
866+ implements SchemaReport .SkippedType {
838867
839868@ Override
840869public String toString () {
841- return (type instanceof GraphQLNamedType namedType ) ? namedType .getName () : type .toString ();
870+ return (this . type instanceof GraphQLNamedType named ) ? named .getName () : this . type .toString ();
842871}
843872
844873public static DefaultSkippedType create (
845- GraphQLType type , GraphQLFieldsContainer parent , GraphQLFieldDefinition field ) {
874+ GraphQLType type , GraphQLFieldsContainer parent , GraphQLFieldDefinition field , String reason ) {
846875
847- return new DefaultSkippedType (type , FieldCoordinates .coordinates (parent , field ));
876+ return new DefaultSkippedType (type , FieldCoordinates .coordinates (parent , field ), reason );
848877}
849878}
850879
0 commit comments