Class: GraphQL::StaticValidation::OperationNamesAreValidError
- Inherits:
-
StaticValidation::Error
- Object
- StaticValidation::Error
- GraphQL::StaticValidation::OperationNamesAreValidError
- Defined in:
- lib/graphql/static_validation/rules/operation_names_are_valid_error.rb
Instance Attribute Summary collapse
-
#operation_name ⇒ Object
readonly
: String?.
Instance Method Summary collapse
-
#code ⇒ Object
: -> String.
-
#initialize(message, path: nil, nodes: [], name: nil) ⇒ OperationNamesAreValidError
constructor
: (String message, ?path: Array[String | Integer]?, ?nodes: GraphQL::Language::Nodes::AbstractNode | Array, ?name: String?) -> void.
-
#to_h ⇒ Object
A hash representation of this Message : -> Hash[String, untyped].
Constructor Details
#initialize(message, path: nil, nodes: [], name: nil) ⇒ OperationNamesAreValidError
: (String message, ?path: Array[String | Integer]?, ?nodes: GraphQL::Language::Nodes::AbstractNode | Array, ?name: String?) -> void
11 12 13 14 |
# File 'lib/graphql/static_validation/rules/operation_names_are_valid_error.rb', line 11 def initialize(, path: nil, nodes: [], name: nil) super(, path: path, nodes: nodes) @operation_name = name #: String? end |
Instance Attribute Details
#operation_name ⇒ Object (readonly)
: String?
8 9 10 |
# File 'lib/graphql/static_validation/rules/operation_names_are_valid_error.rb', line 8 def operation_name @operation_name end |
Instance Method Details
#code ⇒ Object
: -> String
29 30 31 |
# File 'lib/graphql/static_validation/rules/operation_names_are_valid_error.rb', line 29 def code "uniquelyNamedOperations" end |
#to_h ⇒ Object
A hash representation of this Message : -> Hash[String, untyped]
18 19 20 21 22 23 24 25 26 |
# File 'lib/graphql/static_validation/rules/operation_names_are_valid_error.rb', line 18 def to_h extensions = { "code" => code }.tap { |h| h["operationName"] = operation_name unless operation_name.nil? } super.merge({ "extensions" => extensions }) end |