Exception: JsonSchema::ValidationError
- Inherits:
-
SchemaError
- Object
- RuntimeError
- Error
- SchemaError
- JsonSchema::ValidationError
- Defined in:
- lib/json_schema/error.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#path ⇒ Object
Returns the value of attribute path.
-
#sub_errors ⇒ Object
Returns the value of attribute sub_errors.
Attributes inherited from SchemaError
Instance Method Summary collapse
-
#initialize(schema, path, message, type, options = {}) ⇒ ValidationError
constructor
A new instance of ValidationError.
- #pointer ⇒ Object
- #to_s ⇒ Object
Methods inherited from SchemaError
Constructor Details
#initialize(schema, path, message, type, options = {}) ⇒ ValidationError
Returns a new instance of ValidationError.
42 43 44 45 46 47 48 49 50 |
# File 'lib/json_schema/error.rb', line 42 def initialize(schema, path, , type, = {}) super(schema, , type) @path = path # TODO: change to named optional arguments when Ruby 1.9 support is # removed @data = [:data] @sub_errors = [:sub_errors] end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
40 41 42 |
# File 'lib/json_schema/error.rb', line 40 def data @data end |
#path ⇒ Object
Returns the value of attribute path.
40 41 42 |
# File 'lib/json_schema/error.rb', line 40 def path @path end |
#sub_errors ⇒ Object
Returns the value of attribute sub_errors.
40 41 42 |
# File 'lib/json_schema/error.rb', line 40 def sub_errors @sub_errors end |
Instance Method Details
#pointer ⇒ Object
52 53 54 |
# File 'lib/json_schema/error.rb', line 52 def pointer path.join("/") end |
#to_s ⇒ Object
56 57 58 |
# File 'lib/json_schema/error.rb', line 56 def to_s "#{pointer}: failed schema #{schema.pointer}: #{}" end |