Class: 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
Returns the value of attribute variable_name.
-
#violation ⇒ Object
readonly
Returns the value of attribute violation.
Attributes inherited from Error
Instance Method Summary collapse
-
#code ⇒ Object
-
#initialize(message, path: nil, nodes: [], name:, error_type:) ⇒ VariablesAreUsedAndDefinedError
constructor
A new instance of VariablesAreUsedAndDefinedError.
-
#to_h ⇒ Object
A hash representation of this Message.
Constructor Details
#initialize(message, path: nil, nodes: [], name:, error_type:) ⇒ VariablesAreUsedAndDefinedError
Returns a new instance of VariablesAreUsedAndDefinedError.
13 14 15 16 17 18 |
# File 'lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb', line 13 def initialize(, path: nil, nodes: [], name:, error_type:) super(, path: path, nodes: nodes) @variable_name = name raise("Unexpected error type: #{error_type}") if !VIOLATIONS.values.include?(error_type) @violation = error_type end |
Instance Attribute Details
#variable_name ⇒ Object (readonly)
Returns the value of attribute variable_name.
5 6 7 |
# File 'lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb', line 5 def variable_name @variable_name end |
#violation ⇒ Object (readonly)
Returns the value of attribute violation.
6 7 8 |
# File 'lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb', line 6 def violation @violation end |
Instance Method Details
#code ⇒ Object
32 33 34 |
# File 'lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb', line 32 def code @violation end |
#to_h ⇒ Object
A hash representation of this Message
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb', line 21 def to_h extensions = { "code" => code, "variableName" => variable_name } super.merge({ "extensions" => extensions }) end |