Class: GraphQL::StaticValidation::ArgumentsAreDefined

Inherits:
ArgumentsValidator show all
Defined in:
lib/graphql/static_validation/rules/arguments_are_defined.rb

Instance Method Summary collapse

Methods inherited from ArgumentsValidator

#validate

Methods included from Message::MessageHelper

#message

Instance Method Details

#validate_node(node, defn, context) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/graphql/static_validation/rules/arguments_are_defined.rb', line 2

def validate_node(node, defn, context)
  skip = nil

  node.arguments.each do |argument|
    argument_defn = defn.arguments[argument.name]
    if argument_defn.nil?
      context.errors << message("#{node.class.name.split("::").last} '#{node.name}' doesn't accept argument #{argument.name}", node)
      skip = GraphQL::Language::Visitor::SKIP
    end
  end

  skip
end