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/variables_are_input_types.rb', line 5
def on_variable_definition(node, parent)
type_name = get_type_name(node.type)
type = context.query.types.type(type_name)
if type.nil?
add_error(GraphQL::StaticValidation::VariablesAreInputTypesError.new(
"#{type_name} isn't a defined input type (on $#{node.name})",
nodes: node,
name: node.name,
type: type_name
))
elsif !type.kind.input?
add_error(GraphQL::StaticValidation::VariablesAreInputTypesError.new(
"#{type.graphql_name} isn't a valid input type (on $#{node.name})",
nodes: node,
name: node.name,
type: type_name
))
end
super
end
|