Class: OpenapiFirst::Schema::ValidationResult
- Inherits:
-
Object
- Object
- OpenapiFirst::Schema::ValidationResult
- Defined in:
- lib/openapi_first/schema/validation_result.rb
Overview
Result of validating data against a schema. Return value of Schema#validate.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#errors ⇒ Object
Returns an array of ValidationError objects.
-
#initialize(validation) ⇒ ValidationResult
constructor
A new instance of ValidationResult.
Constructor Details
#initialize(validation) ⇒ ValidationResult
Returns a new instance of ValidationResult.
9 10 11 |
# File 'lib/openapi_first/schema/validation_result.rb', line 9 def initialize(validation) @validation = validation end |
Instance Method Details
#error? ⇒ Boolean
13 |
# File 'lib/openapi_first/schema/validation_result.rb', line 13 def error? = @validation.any? |
#errors ⇒ Object
Returns an array of ValidationError objects.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/openapi_first/schema/validation_result.rb', line 16 def errors @errors ||= @validation.map do |err| ValidationError.new( message: err['error'], data_pointer: err['data_pointer'], schema_pointer: err['schema_pointer'], type: err['type'], details: err['details'] ) end end |