Sha256: 0bcf2101ba1a8154975ce67d6f236e8c888c64a799dcfeae08653d7fac987b21
Contents?: true
Size: 697 Bytes
Versions: 3
Compression:
Stored size: 697 Bytes
Contents
class GraphQL::StaticValidation::VariablesAreInputTypes include GraphQL::StaticValidation::Message::MessageHelper def validate(context) context.visitor[GraphQL::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
3 entries across 3 versions & 1 rubygems