class GraphQL::StaticValidation::ArgumentLiteralsAreCompatibleError

Attributes

argument[R]
argument_name[R]
type_name[R]
value[R]

Public Class Methods

new(message, path: nil, nodes: [], type:, argument_name: nil, extensions: nil, coerce_extensions: nil, argument: nil, value: nil) click to toggle source
Calls superclass method GraphQL::StaticValidation::Error::new
# File lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb, line 10
def initialize(message, path: nil, nodes: [], type:, argument_name: nil, extensions: nil, coerce_extensions: nil, argument: nil, value: nil)
  super(message, path: path, nodes: nodes)
  @type_name = type
  @argument_name = argument_name
  @extensions = extensions
  @coerce_extensions = coerce_extensions
  @argument = argument
  @value = value
end

Public Instance Methods

code() click to toggle source
# File lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb, line 43
def code
  "argumentLiteralsIncompatible"
end
to_h() click to toggle source

A hash representation of this Message

Calls superclass method GraphQL::StaticValidation::Error#to_h
# File lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb, line 21
def to_h
  if @coerce_extensions
    extensions = @coerce_extensions
    # This is for legacy compat -- but this key is supposed to be a GraphQL type name :confounded:
    extensions["typeName"] = "CoercionError"
  else
    extensions = {
      "code" => code,
      "typeName" => type_name
    }

    if argument_name
      extensions["argumentName"] = argument_name
    end
  end

  extensions.merge!(@extensions) unless @extensions.nil?
  super.merge({
    "extensions" => extensions
  })
end