@@ -473,7 +473,8 @@ protected GraphQLFieldDefinition getField(Field field) throws GraphQLAnnotations
473473
474474 boolean isConnection = isConnection (field , outputType );
475475 if (isConnection ) {
476- outputType = getGraphQLConnection (field , outputType , builder );
476+ outputType = getGraphQLConnection (field , outputType );
477+ builder .argument (relay .getConnectionFieldArguments ());
477478 }
478479
479480 builder .type (outputType );
@@ -574,24 +575,21 @@ private boolean checkIfPrefixGetterExists(Class c, String prefix, String propert
574575 return true ;
575576 }
576577
577- private GraphQLOutputType getGraphQLConnection (AccessibleObject field , GraphQLOutputType type , GraphQLFieldDefinition . Builder builder ) {
578+ private GraphQLOutputType getGraphQLConnection (AccessibleObject field , GraphQLOutputType type ) {
578579 if (type instanceof GraphQLNonNull ) {
579- type = (GraphQLOutputType ) ((GraphQLNonNull ) type ).getWrappedType ();
580- return new GraphQLNonNull (internalGetGraphQLConnection (field , type , builder ));
580+ GraphQLList listType = (GraphQLList ) ((GraphQLNonNull ) type ).getWrappedType ();
581+ return new GraphQLNonNull (internalGetGraphQLConnection (field , listType ));
581582 } else {
582- return internalGetGraphQLConnection (field , type , builder );
583+ return internalGetGraphQLConnection (field , ( GraphQLList ) type );
583584 }
584585 }
585586
586- private GraphQLOutputType internalGetGraphQLConnection (AccessibleObject field , GraphQLOutputType type , GraphQLFieldDefinition .Builder builder ) {
587- graphql .schema .GraphQLType wrappedType = ((GraphQLList ) type ).getWrappedType ();
588- assert wrappedType instanceof GraphQLObjectType ;
587+ private GraphQLOutputType internalGetGraphQLConnection (AccessibleObject field , GraphQLList listType ) {
588+ GraphQLOutputType wrappedType = (GraphQLOutputType ) listType .getWrappedType ();
589589 String connectionName = field .getAnnotation (GraphQLConnection .class ).name ();
590590 connectionName = connectionName .isEmpty () ? wrappedType .getName () : connectionName ;
591- GraphQLObjectType edgeType = ensureTypeUniqueness (relay .edgeType (connectionName , (GraphQLOutputType ) wrappedType , null , Collections .<GraphQLFieldDefinition >emptyList ()));
592- type = ensureTypeUniqueness (relay .connectionType (connectionName , edgeType , Collections .emptyList ()));
593- builder .argument (relay .getConnectionFieldArguments ());
594- return type ;
591+ GraphQLObjectType edgeType = ensureTypeUniqueness (relay .edgeType (connectionName , wrappedType , null , Collections .<GraphQLFieldDefinition >emptyList ()));
592+ return ensureTypeUniqueness (relay .connectionType (connectionName , edgeType , Collections .emptyList ()));
595593 }
596594
597595 private GraphQLObjectType ensureTypeUniqueness (GraphQLObjectType type ) {
@@ -639,7 +637,8 @@ protected GraphQLFieldDefinition getField(Method method) throws GraphQLAnnotatio
639637
640638 boolean isConnection = isConnection (method , outputType );
641639 if (isConnection ) {
642- outputType = getGraphQLConnection (method , outputType , builder );
640+ outputType = getGraphQLConnection (method , outputType );
641+ builder .argument (relay .getConnectionFieldArguments ());
643642 }
644643
645644 builder .type (outputType );
0 commit comments