Module: GraphQL::StaticValidation::FieldsWillMerge

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

Defined Under Namespace

Classes: Field, FragmentSpread

Constant Summary

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

{}.freeze

Instance Method Summary collapse

Instance Method Details

#initializeObject



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

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

#on_field(node, _parent) ⇒ Object



27
28
29
30
# File 'lib/graphql/static_validation/rules/fields_will_merge.rb', line 27

def on_field(node, _parent)
  conflicts_within_selection_set(node, type_definition)
  super
end

#on_operation_definition(node, _parent) ⇒ Object



22
23
24
25
# File 'lib/graphql/static_validation/rules/fields_will_merge.rb', line 22

def on_operation_definition(node, _parent)
  conflicts_within_selection_set(node, type_definition)
  super
end