Method: GraphQL::StaticValidation::FieldsWillMergeError#add_conflict

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

#add_conflict(node, conflict_str) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/graphql/static_validation/rules/fields_will_merge_error.rb', line 30

def add_conflict(node, conflict_str)
  # Can't use `.include?` here because AST nodes implement `#==`
  # based on string value, not including location. But sometimes,
  # identical nodes conflict because of their differing return types.
  if nodes.any? { |n| n == node && n.line == node.line && n.col == node.col }
    # already have an error for this node
    return
  end

  @nodes << node
  @conflicts << conflict_str
end