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(parent, node, defn, context) ⇒ Object



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

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