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 committed Oct 26, 2023
1 parent b9e489d commit 05fc82f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import graphql.execution.Async;
import graphql.execution.DataFetcherResult;
import graphql.language.NonNullType;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import graphql.schema.DelegatingDataFetchingEnvironment;
Expand All @@ -27,8 +28,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 +119,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 05fc82f

Please sign in to comment.