Class: GraphQL::StaticValidation::VariablesAreUsedAndDefinedError
- Inherits:
-
StaticValidation::Error
- Object
- StaticValidation::Error
- GraphQL::StaticValidation::VariablesAreUsedAndDefinedError
- Defined in:
- lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb
Constant Summary collapse
- VIOLATIONS =
{ :VARIABLE_NOT_USED => "variableNotUsed", :VARIABLE_NOT_DEFINED => "variableNotDefined", }
Instance Attribute Summary collapse
-
#variable_name ⇒ Object
readonly
: String.
-
#violation ⇒ Object
readonly
: String.
Instance Method Summary collapse
-
#code ⇒ Object
: -> String.
-
#initialize(message, name:, error_type:, path: nil, nodes: []) ⇒ VariablesAreUsedAndDefinedError
constructor
: (String message, name: String, error_type: String, ?path: Array[String | Integer]?, ?nodes: GraphQL::Language::Nodes::AbstractNode | Array) -> void.
-
#to_h ⇒ Object
A hash representation of this Message : -> Hash[String, untyped].
Constructor Details
#initialize(message, name:, error_type:, path: nil, nodes: []) ⇒ VariablesAreUsedAndDefinedError
: (String message, name: String, error_type: String, ?path: Array[String | Integer]?, ?nodes: GraphQL::Language::Nodes::AbstractNode | Array) -> void
18 19 20 21 22 23 |
# File 'lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb', line 18 def initialize(, name:, error_type:, path: nil, nodes: []) super(, path: path, nodes: nodes) @variable_name = name #: String raise("Unexpected error type: #{error_type}") if !VIOLATIONS.values.include?(error_type) @violation = error_type #: String end |
Instance Attribute Details
#variable_name ⇒ Object (readonly)
: String
8 9 10 |
# File 'lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb', line 8 def variable_name @variable_name end |
#violation ⇒ Object (readonly)
: String
10 11 12 |
# File 'lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb', line 10 def violation @violation end |
Instance Method Details
#code ⇒ Object
: -> String
39 40 41 |
# File 'lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb', line 39 def code @violation end |
#to_h ⇒ Object
A hash representation of this Message : -> Hash[String, untyped]
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb', line 27 def to_h extensions = { "code" => code, "variableName" => variable_name } super.merge({ "extensions" => extensions }) end |