Class: JSONSchemer::Draft202012::Vocab::Unevaluated::UnevaluatedProperties
- Inherits:
-
Keyword
- Object
- Keyword
- JSONSchemer::Draft202012::Vocab::Unevaluated::UnevaluatedProperties
- Defined in:
- lib/json_schemer/draft202012/vocab/unevaluated.rb
Constant Summary
Constants included from Output
Instance Attribute Summary
Attributes inherited from Keyword
#parent, #parsed, #root, #value
Attributes included from Output
Instance Method Summary collapse
- #error(formatted_instance_location:) ⇒ Object
- #false_schema_error(formatted_instance_location:) ⇒ Object
- #parse ⇒ Object
- #validate(instance, instance_location, keyword_location, context) ⇒ Object
Methods inherited from Keyword
#absolute_keyword_location, #error_key, #fetch, #initialize, #parsed_schema, #schema_pointer
Methods included from Output
Constructor Details
This class inherits a constructor from JSONSchemer::Keyword
Instance Method Details
#error(formatted_instance_location:) ⇒ Object
55 56 57 |
# File 'lib/json_schemer/draft202012/vocab/unevaluated.rb', line 55 def error(formatted_instance_location:, **) "object properties at #{formatted_instance_location} do not match `unevaluatedProperties` schema" end |
#false_schema_error(formatted_instance_location:) ⇒ Object
59 60 61 |
# File 'lib/json_schemer/draft202012/vocab/unevaluated.rb', line 59 def false_schema_error(formatted_instance_location:, **) "object property at #{formatted_instance_location} is a disallowed unevaluated property" end |
#parse ⇒ Object
63 64 65 |
# File 'lib/json_schemer/draft202012/vocab/unevaluated.rb', line 63 def parse subschema(value) end |
#validate(instance, instance_location, keyword_location, context) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/json_schemer/draft202012/vocab/unevaluated.rb', line 67 def validate(instance, instance_location, keyword_location, context) return result(instance, instance_location, keyword_location, true) unless instance.is_a?(Hash) evaluated_keys = Set[] context.adjacent_results.each_value do |adjacent_result| collect_evaluated_keys(adjacent_result, evaluated_keys) end evaluated = instance.reject do |key, _value| evaluated_keys.include?(key) end nested = evaluated.map do |key, value| parsed.validate_instance(value, join_location(instance_location, key), keyword_location, context) end result(instance, instance_location, keyword_location, nested.all?(&:valid), nested, :annotation => evaluated.keys) end |