Class: JSONSkooma::Keywords::Applicator::DependentSchemas
- Defined in:
- lib/json_skooma/keywords/applicator/dependent_schemas.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
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/json_skooma/keywords/applicator/dependent_schemas.rb', line 11 def evaluate(instance, result) annotation = [] err_names = [] json.each do |name, subschema| next unless instance.key?(name) result.call(instance, name) do |subresult| if subschema.evaluate(instance, subresult).passed? annotation << name else err_names << name end end end return result.annotate(annotation) if err_names.none? result.failure( "Properties #{err_names} are invalid against the corresponding `dependentSchemas` subschemas" ) end |