Method: GraphQL::StaticValidation::ArgumentLiteralsAreCompatibleError#to_h

Defined in:
lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb

#to_hObject

A hash representation of this Message



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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