Class: Openapi3Parser::Validation::Error
- Inherits:
-
Object
- Object
- Openapi3Parser::Validation::Error
- Extended by:
- Forwardable
- Defined in:
- lib/openapi3_parser/validation/error.rb
Overview
Represents a validation error for an OpenAPI document
Instance Attribute Summary collapse
-
#context ⇒ Context
readonly
The context where this was validated.
-
#factory_class ⇒ Class?
readonly
The NodeFactory that was being created when this error was found.
-
#message ⇒ String
(also: #to_s)
readonly
The error message.
Instance Method Summary collapse
- #==(other) ⇒ Boolean
- #for_type ⇒ String?
-
#initialize(message, context, factory_class = nil) ⇒ Error
constructor
A new instance of Error.
- #inspect ⇒ String
-
#source_location ⇒ Context::Location
The source file and pointer for where this error occurred.
Constructor Details
#initialize(message, context, factory_class = nil) ⇒ Error
Returns a new instance of Error.
28 29 30 31 32 |
# File 'lib/openapi3_parser/validation/error.rb', line 28 def initialize(, context, factory_class = nil) @message = @context = context @factory_class = factory_class end |
Instance Attribute Details
#context ⇒ Context (readonly)
The context where this was validated
13 14 15 |
# File 'lib/openapi3_parser/validation/error.rb', line 13 def context @context end |
#factory_class ⇒ Class? (readonly)
The NodeFactory that was being created when this error was found
13 14 15 |
# File 'lib/openapi3_parser/validation/error.rb', line 13 def factory_class @factory_class end |
#message ⇒ String (readonly) Also known as: to_s
The error message
13 14 15 |
# File 'lib/openapi3_parser/validation/error.rb', line 13 def @message end |
Instance Method Details
#==(other) ⇒ Boolean
49 50 51 52 53 54 55 |
# File 'lib/openapi3_parser/validation/error.rb', line 49 def ==(other) return false unless other.instance_of?(self.class) == other. && context == other.context && factory_class == other.factory_class end |
#for_type ⇒ String?
35 36 37 38 39 40 |
# File 'lib/openapi3_parser/validation/error.rb', line 35 def for_type return unless factory_class return "(anonymous)" unless factory_class.name factory_class.name.split("::").last end |
#inspect ⇒ String
43 44 45 46 |
# File 'lib/openapi3_parser/validation/error.rb', line 43 def inspect "#{self.class.name}(message: #{}, context: #{context}, " \ "for_type: #{for_type})" end |
#source_location ⇒ Context::Location
The source file and pointer for where this error occurred
21 |
# File 'lib/openapi3_parser/validation/error.rb', line 21 def_delegator :context, :source_location |