From 6c18af0f369cab66f2dcea4545b97b47fb7e5c5b Mon Sep 17 00:00:00 2001 From: Andreas Marek Date: Sat, 30 Jan 2021 11:26:20 +1100 Subject: [PATCH] Clarify comment about mutually exclusive parents --- src/validation/rules/OverlappingFieldsCanBeMergedRule.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/validation/rules/OverlappingFieldsCanBeMergedRule.js b/src/validation/rules/OverlappingFieldsCanBeMergedRule.js index 2d79dd098f..9b41d5a3fb 100644 --- a/src/validation/rules/OverlappingFieldsCanBeMergedRule.js +++ b/src/validation/rules/OverlappingFieldsCanBeMergedRule.js @@ -551,9 +551,13 @@ function findConflict( // in aliased field or arguments used as they will not present any ambiguity // by differing. // It is known that two parent types could never overlap if they are - // different Object types. Interface or Union types might overlap - if not + // different Object types. Interface types might overlap - if not // in the current state of the schema, then perhaps in some future version, - // thus may not safely diverge. + // thus may not safely diverge. + // The only field that can have a Union as parent is __typename which can't + // conflict as it is a Scalar with no arguments. Therefore the condition + // could be arguably changed to "isObjectOrUnionType", but this implementation + // follows the current spec. const areMutuallyExclusive = parentFieldsAreMutuallyExclusive || (parentType1 !== parentType2 &&