Class: GraphQL::StaticValidation::DirectivesAreInValidLocationsError
- Defined in:
- lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#target_name ⇒ Object
readonly
Returns the value of attribute target_name.
Attributes inherited from Error
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(message, path: nil, nodes: [], target:, name: nil) ⇒ DirectivesAreInValidLocationsError
constructor
A new instance of DirectivesAreInValidLocationsError.
-
#to_h ⇒ Object
A hash representation of this Message.
Constructor Details
#initialize(message, path: nil, nodes: [], target:, name: nil) ⇒ DirectivesAreInValidLocationsError
Returns a new instance of DirectivesAreInValidLocationsError.
8 9 10 11 12 |
# File 'lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb', line 8 def initialize(, path: nil, nodes: [], target:, name: nil) super(, path: path, nodes: nodes) @target_name = target @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb', line 6 def name @name end |
#target_name ⇒ Object (readonly)
Returns the value of attribute target_name.
5 6 7 |
# File 'lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb', line 5 def target_name @target_name end |
Instance Method Details
#code ⇒ Object
26 27 28 |
# File 'lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb', line 26 def code "directiveCannotBeApplied" end |
#to_h ⇒ Object
A hash representation of this Message
15 16 17 18 19 20 21 22 23 24 |
# 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 |