Module: GraphQL::StaticValidation::FieldsWillMerge

Defined in:
lib/graphql/static_validation/rules/fields_will_merge.rb

Defined Under Namespace

Classes: Field, FragmentSpread

Constant Summary collapse

NO_ARGS =

Validates that a selection set is valid if all fields (including spreading any fragments) either correspond to distinct response names or can be merged without ambiguity.

Original Algorithm: https://github.com/graphql/graphql-js/blob/master/src/validation/rules/OverlappingFieldsCanBeMerged.js

GraphQL::EmptyObjects::EMPTY_HASH

Instance Method Summary collapse

Instance Method Details

#initializeObject



17
18
19
20
21
22
# File 'lib/graphql/static_validation/rules/fields_will_merge.rb', line 17

def initialize(*)
  super
  @visited_fragments = {}
  @compared_fragments = {}
  @conflict_count = 0
end

#on_field(node, _parent) ⇒ Object



29
30
31
32
# File 'lib/graphql/static_validation/rules/fields_will_merge.rb', line 29

def on_field(node, _parent)
  setting_errors { conflicts_within_selection_set(node, type_definition) }
  super
end

#on_operation_definition(node, _parent) ⇒ Object



24
25
26
27
# File 'lib/graphql/static_validation/rules/fields_will_merge.rb', line 24

def on_operation_definition(node, _parent)
  setting_errors { conflicts_within_selection_set(node, type_definition) }
  super
end