class GraphQL::StaticValidation::DirectivesAreInValidLocationsError

Attributes

name[R]
target_name[R]

Public Class Methods

new(message, path: nil, nodes: [], target:, name: nil) click to toggle source
Calls superclass method GraphQL::StaticValidation::Error::new
# File lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb, line 8
def initialize(message, path: nil, nodes: [], target:, name: nil)
  super(message, path: path, nodes: nodes)
  @target_name = target
  @name = name
end

Public Instance Methods

code() click to toggle source
# File lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb, line 26
def code
  "directiveCannotBeApplied"
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/directives_are_in_valid_locations_error.rb, line 15
def to_h
  extensions = {
    "code" => code,
    "targetName" => target_name
  }.tap { |h| h["name"] = name unless name.nil? }

  super.merge({
    "extensions" => extensions
  })
end