@@ -82,6 +82,8 @@ public class GraphQLAnnotations implements GraphQLAnnotationsProcessor {
8282
8383 private static final Relay RELAY_TYPES = new Relay ();
8484
85+ private static final List <Class > TYPES_FOR_CONNECTION = Arrays .asList (GraphQLObjectType .class , GraphQLInterfaceType .class , GraphQLUnionType .class , GraphQLTypeReference .class );
86+
8587 private Map <String , graphql .schema .GraphQLType > typeRegistry = new HashMap <>();
8688 private final Stack <String > processing = new Stack <>();
8789
@@ -510,8 +512,7 @@ private GraphQLOutputType getGraphQLConnection(boolean isConnection, AccessibleO
510512
511513 private boolean isConnection (AccessibleObject obj , Class <?> klass , GraphQLOutputType type ) {
512514 return obj .isAnnotationPresent (GraphQLConnection .class ) &&
513- type instanceof GraphQLList &&
514- ((GraphQLList ) type ).getWrappedType () instanceof GraphQLObjectType ;
515+ type instanceof GraphQLList && TYPES_FOR_CONNECTION .stream ().anyMatch (aClass -> aClass .isInstance (((GraphQLList ) type ).getWrappedType ()));
515516 }
516517
517518 protected GraphQLFieldDefinition getField (Method method ) throws GraphQLAnnotationsException {
@@ -707,8 +708,10 @@ public ConnectionDataFetcher(Class<? extends Connection> connection, DataFetcher
707708
708709 @ Override
709710 public Object get (DataFetchingEnvironment environment ) {
710- // Exclude arguments
711- DataFetchingEnvironment env = new DataFetchingEnvironmentImpl (environment .getSource (), new HashMap <>(), environment .getContext (),
711+ // Create a list of arguments with connection specific arguments excluded
712+ HashMap <String , Object > arguments = new HashMap <>(environment .getArguments ());
713+ arguments .keySet ().removeAll (Arrays .asList ("first" , "last" , "before" , "after" ));
714+ DataFetchingEnvironment env = new DataFetchingEnvironmentImpl (environment .getSource (), arguments , environment .getContext (),
712715 environment .getFields (), environment .getFieldType (), environment .getParentType (), environment .getGraphQLSchema (),
713716 environment .getFragmentsByName (), environment .getExecutionId (), environment .getSelectionSet ());
714717 Connection conn = constructNewInstance (constructor , actualDataFetcher .get (env ));
0 commit comments