Sha256: f1f9385c0236895d3a200b90423e80dd8ea2584bc5953c9d2f4a89aee11e4787
Contents?: true
Size: 707 Bytes
Versions: 21
Compression:
Stored size: 707 Bytes
Contents
class GraphQL::StaticValidation::VariablesAreInputTypes include GraphQL::StaticValidation::Message::MessageHelper def validate(context) context.visitor[GraphQL::Language::Nodes::Variable] << -> (node, parent) { validate_is_input_type(node, context) } end private def validate_is_input_type(node, context) type_name = get_type_name(node.type) type = context.schema.types[type_name] if !type.kind.input? context.errors << message("#{type.name} isn't a valid input type (on $#{node.name})", node) end end def get_type_name(ast_type) if ast_type.respond_to?(:of_type) get_type_name(ast_type.of_type) else ast_type.name end end end
Version data entries
21 entries across 21 versions & 1 rubygems