Skip to content

Commit 875b290

Browse files
committed
now "isConnection" has a ConnectionValidator interface that checks what is the validator value in the @GraphQLConnection
1 parent 9aa489a commit 875b290

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/main/java/graphql/annotations/GraphQLAnnotations.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Copyright 2016 Yurii Rashkovskii
3-
*
3+
* <p>
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
7+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,9 +15,7 @@
1515
package graphql.annotations;
1616

1717
import graphql.TypeResolutionEnvironment;
18-
import graphql.annotations.connection.ConnectionDataFetcher;
19-
import graphql.annotations.connection.ConnectionTypeValidator;
20-
import graphql.annotations.connection.GraphQLConnection;
18+
import graphql.annotations.connection.*;
2119
import graphql.relay.Relay;
2220
import graphql.schema.*;
2321
import graphql.schema.GraphQLNonNull;
@@ -603,7 +601,6 @@ private GraphQLObjectType getActualType(GraphQLObjectType type) {
603601
}
604602

605603
private boolean isConnection(AccessibleObject obj, GraphQLOutputType type) {
606-
ConnectionTypeValidator validator = new ConnectionTypeValidator();
607604
if (type instanceof GraphQLNonNull) {
608605
type = (GraphQLOutputType) ((GraphQLNonNull) type).getWrappedType();
609606
}
@@ -613,7 +610,8 @@ private boolean isConnection(AccessibleObject obj, GraphQLOutputType type) {
613610
actualType instanceof GraphQLList && TYPES_FOR_CONNECTION.stream().anyMatch(aClass ->
614611
aClass.isInstance(((GraphQLList) actualType).getWrappedType()));
615612

616-
if(isValidGraphQLTypeForConnection) {
613+
if (isValidGraphQLTypeForConnection) {
614+
ConnectionValidator validator = newInstance(obj.getAnnotation(GraphQLConnection.class).validator());
617615
validator.validate(obj);
618616
return true;
619617
} else {

0 commit comments

Comments
 (0)