Sha256: 8988b9b490d23d312bd639b1d70c76e2b36e7111eda0493e6c6ca4d32941e488

Contents?: true

Size: 632 Bytes

Versions: 4

Compression:

Stored size: 632 Bytes

Contents

class GraphQL::StaticValidation::ArgumentLiteralsAreCompatible < GraphQL::StaticValidation::ArgumentsValidator
  def validate_node(node, defn, context)
    args_with_literals = node.arguments.select {|a| !a.value.is_a?(GraphQL::Nodes::VariableIdentifier)}
    validator = GraphQL::StaticValidation::LiteralValidator.new
    args_with_literals.each do |arg|
      arg_defn = defn.arguments[arg.name]
      valid = validator.validate(arg.value, arg_defn.type)
      if !valid
        context.errors << message("#{arg.name} on #{node.class.name.split("::").last} '#{node.name}' has an invalid value", node)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
graphql-0.5.0 lib/graph_ql/static_validation/rules/argument_literals_are_compatible.rb
graphql-0.4.0 lib/graph_ql/static_validation/rules/argument_literals_are_compatible.rb
graphql-0.3.0 lib/graph_ql/static_validation/rules/argument_literals_are_compatible.rb
graphql-0.2.0 lib/graph_ql/static_validation/argument_literals_are_compatible.rb