5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/graphql/static_validation/rules/arguments_are_defined.rb', line 5
def on_argument(node, parent)
parent_defn = parent_definition(parent)
if parent_defn && @types.argument(parent_defn, node.name)
super
elsif parent_defn
kind_of_node = node_type(parent)
error_arg_name = parent_name(parent, parent_defn)
arg_names = context.types.arguments(parent_defn).map(&:graphql_name)
add_error(GraphQL::StaticValidation::ArgumentsAreDefinedError.new(
"#{kind_of_node} '#{error_arg_name}' doesn't accept argument '#{node.name}'#{context.did_you_mean_suggestion(node.name, arg_names)}",
nodes: node,
name: error_arg_name,
type: kind_of_node,
argument_name: node.name,
parent: parent_defn
))
else
super
end
end
|