Skip to content

Commit c7fc999

Browse files
committed
polish(validation): skip empty field comparisons
Replicates graphql/graphql-js@1d02365
1 parent 32997e6 commit c7fc999

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎src/graphql/validation/rules/overlapping_fields_can_be_merged.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ def collect_conflicts_between_fields_and_fragment(
302302
Collect all conflicts found between a set of fields and a fragment reference
303303
including via spreading in any nested fragments.
304304
"""
305+
if not field_map:
306+
return
307+
305308
compared_fields_and_fragment_pairs = rule_context.compared_fields_and_fragment_pairs
306309
# Memoize so the fields and fragments are not compared for conflicts more
307310
# than once.
@@ -546,6 +549,9 @@ def collect_conflicts_between(
546549
already been called on each provided collection of fields. This is true because
547550
this validator traverses each individual selection set.
548551
"""
552+
if not field_map1 or not field_map2:
553+
return
554+
549555
# A field map is a keyed collection, where each key represents a response name and
550556
# the value at that key is a list of all fields which provide that response name.
551557
# For any response name which appears in both provided field maps, each field from

0 commit comments

Comments
 (0)