From 75cde71e303cc88fdc8a8f1873ed7d168e0bc5b7 Mon Sep 17 00:00:00 2001 From: Robert Pospisil Date: Thu, 26 Oct 2023 14:26:55 +0200 Subject: [PATCH] Support non null types in batch resolver --- .../smallrye/graphql/bootstrap/FederationDataFetcher.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/implementation/src/main/java/io/smallrye/graphql/bootstrap/FederationDataFetcher.java b/server/implementation/src/main/java/io/smallrye/graphql/bootstrap/FederationDataFetcher.java index 91e5c794e..40a236947 100644 --- a/server/implementation/src/main/java/io/smallrye/graphql/bootstrap/FederationDataFetcher.java +++ b/server/implementation/src/main/java/io/smallrye/graphql/bootstrap/FederationDataFetcher.java @@ -27,8 +27,10 @@ import graphql.schema.GraphQLFieldDefinition; import graphql.schema.GraphQLList; import graphql.schema.GraphQLNamedSchemaElement; +import graphql.schema.GraphQLNonNull; import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; +import graphql.schema.GraphQLType; import io.smallrye.graphql.spi.config.Config; class FederationDataFetcher implements DataFetcher>> { @@ -116,7 +118,10 @@ private boolean matchesReturnType(GraphQLFieldDefinition field, String typename) } private boolean matchesReturnTypeList(GraphQLFieldDefinition field, String typename) { - GraphQLOutputType listType = field.getType(); + GraphQLType listType = field.getType(); + if (listType instanceof GraphQLNonNull) { + listType = ((GraphQLNonNull) listType).getOriginalWrappedType(); + } if (listType instanceof GraphQLList) { var returnType = ((GraphQLList) listType).getOriginalWrappedType(); return returnType instanceof GraphQLNamedSchemaElement