Exception: OpenAPIParser::ValidateError

Inherits:
OpenAPIError
  • Object
show all
Defined in:
lib/openapi_parser/errors.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, type, reference) ⇒ ValidateError

Returns a new instance of ValidateError.



15
16
17
18
19
# File 'lib/openapi_parser/errors.rb', line 15

def initialize(data, type, reference)
  super(reference)
  @data = data
  @type = type
end

Class Method Details

.build_error_result(value, schema) ⇒ Object

create ValidateError for SchemaValidator return data

Parameters:



29
30
31
# File 'lib/openapi_parser/errors.rb', line 29

def build_error_result(value, schema)
  [nil, OpenAPIParser::ValidateError.new(value, schema.type, schema.object_reference)]
end

Instance Method Details

#messageObject



21
22
23
# File 'lib/openapi_parser/errors.rb', line 21

def message
  "#{@reference} expected #{@type}, but received #{@data.class}: #{@data.inspect}"
end