Skip to content

Commit 367e224

Browse files
committed
ignore fields with unknown type
1 parent ebb0d20 commit 367e224

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/graphql/validation/rules/OverlappingFieldsCanBeMerged.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ private Conflict findConflict(String responseName, FieldAndType fieldAndType1, F
9494
}
9595

9696
if (!sameType(type1, type2)) {
97-
String reason = String.format("%s: they return differing types %s and %s", responseName, type1.getName(), type2.getName());
97+
String name1 = type1 != null ? type1.getName() : "null";
98+
String name2 = type2 != null ? type2.getName() : "null";
99+
String reason = String.format("%s: they return differing types %s and %s", responseName, name1, name2);
98100
return new Conflict(responseName, reason, field1, field2);
99101
}
100102

@@ -150,9 +152,7 @@ private String joinReasons(List<Conflict> conflicts) {
150152
}
151153

152154
private boolean sameType(GraphQLType type1, GraphQLType type2) {
153-
if (type1 == null && type2 == null) return true;
154-
if (type1 == null) return false;
155-
if (type2 == null) return false;
155+
if (type1 == null || type2 == null) return true;
156156
return type1.equals(type2);
157157
}
158158

0 commit comments

Comments
 (0)