Skip to content

Commit ebc39ca

Browse files
committed
wip
1 parent 9ee7e94 commit ebc39ca

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/main/java/graphql/schema/validation/TypesImplementInterfaces.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package graphql.schema.validation;
22

33
import graphql.Internal;
4+
import graphql.execution.ValuesResolver;
5+
import graphql.language.Value;
46
import graphql.schema.GraphQLArgument;
57
import graphql.schema.GraphQLFieldDefinition;
68
import graphql.schema.GraphQLImplementingType;
@@ -23,6 +25,7 @@
2325
import java.util.stream.Collectors;
2426

2527
import static graphql.collect.ImmutableKit.map;
28+
import static graphql.language.AstPrinter.printAst;
2629
import static graphql.schema.GraphQLTypeUtil.isList;
2730
import static graphql.schema.GraphQLTypeUtil.isNonNull;
2831
import static graphql.schema.GraphQLTypeUtil.simplePrint;
@@ -147,7 +150,13 @@ private void checkFieldArgumentEquivalence(GraphQLImplementingType implementingT
147150
if (!interfaceArgStr.equals(objectArgStr)) {
148151
same = false;
149152
}
150-
if (!Objects.equals(objectArg.getDefaultValue(), interfaceArg.getDefaultValue())) {
153+
if (objectArg.hasSetDefaultValue() && interfaceArg.hasSetDefaultValue()) {
154+
Value<?> objectDefaultValue = ValuesResolver.valueToLiteral(objectArg.getDefaultValue(), objectArg.getDefaultValueState(), objectArg.getType());
155+
Value<?> interfaceDefaultValue = ValuesResolver.valueToLiteral(interfaceArg.getDefaultValue(), interfaceArg.getDefaultValueState(), interfaceArg.getType());
156+
if (!Objects.equals(printAst(objectDefaultValue), printAst(interfaceDefaultValue))) {
157+
same = false;
158+
}
159+
} else if (objectArg.hasSetDefaultValue() || interfaceArg.hasSetDefaultValue()) {
151160
same = false;
152161
}
153162
if (!same) {

0 commit comments

Comments
 (0)