Class: GraphQL::StaticValidation::VariableDefaultValuesAreCorrectlyTypedError
- Inherits:
-
Error
- Object
- Error
- GraphQL::StaticValidation::VariableDefaultValuesAreCorrectlyTypedError
- Defined in:
- lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb
Constant Summary collapse
- VIOLATIONS =
{ :INVALID_TYPE => "defaultValueInvalidType", :INVALID_ON_NON_NULL => "defaultValueInvalidOnNonNullVariable", }
Instance Attribute Summary collapse
-
#type_name ⇒ Object
readonly
Returns the value of attribute type_name.
-
#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:, type: nil, error_type:) ⇒ VariableDefaultValuesAreCorrectlyTypedError
constructor
A new instance of VariableDefaultValuesAreCorrectlyTypedError.
-
#to_h ⇒ Object
A hash representation of this Message.
Constructor Details
#initialize(message, path: nil, nodes: [], name:, type: nil, error_type:) ⇒ VariableDefaultValuesAreCorrectlyTypedError
Returns a new instance of VariableDefaultValuesAreCorrectlyTypedError.
14 15 16 17 18 19 20 |
# File 'lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb', line 14 def initialize(, path: nil, nodes: [], name:, type: nil, error_type:) super(, path: path, nodes: nodes) @variable_name = name @type_name = type raise("Unexpected error type: #{error_type}") if !VIOLATIONS.values.include?(error_type) @violation = error_type end |
Instance Attribute Details
#type_name ⇒ Object (readonly)
Returns the value of attribute type_name.
6 7 8 |
# File 'lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb', line 6 def type_name @type_name end |
#variable_name ⇒ Object (readonly)
Returns the value of attribute variable_name.
5 6 7 |
# File 'lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb', line 5 def variable_name @variable_name end |
#violation ⇒ Object (readonly)
Returns the value of attribute violation.
7 8 9 |
# File 'lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb', line 7 def violation @violation end |
Instance Method Details
#code ⇒ Object
34 35 36 |
# File 'lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb', line 34 def code @violation end |
#to_h ⇒ Object
A hash representation of this Message
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb', line 23 def to_h extensions = { "code" => code, "variableName" => variable_name }.tap { |h| h["typeName"] = type_name unless type_name.nil? } super.merge({ "extensions" => extensions }) end |