Skip to content

Commit

Permalink
Support non null types in batch resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Pospisil authored and jmartisk committed Oct 27, 2023
1 parent b9e489d commit 75cde71
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<CompletableFuture<List<Object>>> {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 75cde71

Please sign in to comment.