Class: JSONSkooma::Keywords::Applicator::AllOf
- Defined in:
- lib/json_skooma/keywords/applicator/all_of.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#each_schema, inherited, #initialize, #instance_types, #key, #resolve, set_defaults, #static, value_schema=
Constructor Details
This class inherits a constructor from JSONSkooma::Keywords::Base
Instance Method Details
#evaluate(instance, result) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/json_skooma/keywords/applicator/all_of.rb', line 10 def evaluate(instance, result) err_indices = [] json.each.with_index do |subschema, index| result.call(instance, index.to_s) do |subresult| subschema.evaluate(instance, subresult) err_indices << index unless subresult.passed? end end return if err_indices.empty? result.failure("The instance is invalid against subschemas #{err_indices.join(", ")}") end |