Class: GraphQL::StaticValidation::Error
- Inherits:
-
Object
- Object
- GraphQL::StaticValidation::Error
- Defined in:
- lib/graphql/static_validation/error.rb
Overview
Generates GraphQL-compliant validation message.
Direct Known Subclasses
ArgumentLiteralsAreCompatibleError, ArgumentNamesAreUniqueError, ArgumentsAreDefinedError, DirectivesAreDefinedError, DirectivesAreInValidLocationsError, FieldsAreDefinedOnTypeError, FieldsHaveAppropriateSelectionsError, FieldsWillMergeError, FragmentNamesAreUniqueError, FragmentSpreadsArePossibleError, FragmentTypesExistError, FragmentsAreFiniteError, FragmentsAreNamedError, FragmentsAreOnCompositeTypesError, FragmentsAreUsedError, MutationRootExistsError, NoDefinitionsArePresentError, OperationNamesAreValidError, RequiredArgumentsArePresentError, RequiredInputObjectAttributesArePresentError, SubscriptionRootExistsError, UniqueDirectivesPerLocationError, VariableDefaultValuesAreCorrectlyTypedError, VariableNamesAreUniqueError, VariableUsagesAreAllowedError, VariablesAreInputTypesError, VariablesAreUsedAndDefinedError
Defined Under Namespace
Modules: ErrorHelper
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(message, path: nil, nodes: []) ⇒ Error
constructor
A new instance of Error.
-
#to_h ⇒ Object
A hash representation of this Message.
Constructor Details
#initialize(message, path: nil, nodes: []) ⇒ Error
Returns a new instance of Error
19 20 21 22 23 |
# File 'lib/graphql/static_validation/error.rb', line 19 def initialize(, path: nil, nodes: []) @message = @nodes = Array(nodes) @path = path end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message
16 17 18 |
# File 'lib/graphql/static_validation/error.rb', line 16 def @message end |
#path ⇒ Object
Returns the value of attribute path
17 18 19 |
# File 'lib/graphql/static_validation/error.rb', line 17 def path @path end |
Instance Method Details
#to_h ⇒ Object
A hash representation of this Message
26 27 28 29 30 31 |
# File 'lib/graphql/static_validation/error.rb', line 26 def to_h { "message" => , "locations" => locations }.tap { |h| h["path"] = path unless path.nil? } end |