class JTD::ValidationError
Represents a single JSON Type Definition validation error.
ValidationError
does not extend StandardError; it is not a Ruby exception. It is a plain old Ruby object.
Every ValidationError
has two attributes:
-
instance_path
is an array of strings. It represents the path to the part of theinstance
passed toJTD::validate
that was rejected. -
schema_path
is an array of strings. It represents the path to the part of theschema
passed toJTD::validate
that rejected the instance atinstance_path
.
Public Class Methods
from_hash(hash)
click to toggle source
Constructs a new ValidationError
from the standard JSON representation of a validation error in JSON Type Definition.
# File lib/jtd/validate.rb, line 100 def self.from_hash(hash) instance_path = hash['instancePath'] schema_path = hash['schemaPath'] ValidationError.new(instance_path, schema_path) end