Class: JSONSchemer::OpenAPI31::Vocab::Base::AllOf
- Inherits:
-
Draft202012::Vocab::Applicator::AllOf
- Object
- Keyword
- Draft202012::Vocab::Applicator::AllOf
- JSONSchemer::OpenAPI31::Vocab::Base::AllOf
- Defined in:
- lib/json_schemer/openapi31/vocab/base.rb
Constant Summary
Constants included from JSONSchemer::Output
JSONSchemer::Output::FRAGMENT_ENCODE_REGEX
Instance Attribute Summary collapse
-
#skip_ref_once ⇒ Object
Returns the value of attribute skip_ref_once.
Attributes inherited from Keyword
#parent, #parsed, #root, #value
Attributes included from JSONSchemer::Output
Instance Method Summary collapse
Methods inherited from Draft202012::Vocab::Applicator::AllOf
Methods inherited from Keyword
#absolute_keyword_location, #error_key, #fetch, #initialize, #parsed_schema, #schema_pointer
Methods included from JSONSchemer::Output
Constructor Details
This class inherits a constructor from JSONSchemer::Keyword
Instance Attribute Details
#skip_ref_once ⇒ Object
Returns the value of attribute skip_ref_once.
7 8 9 |
# File 'lib/json_schemer/openapi31/vocab/base.rb', line 7 def skip_ref_once @skip_ref_once end |
Instance Method Details
#validate(instance, instance_location, keyword_location, context) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/json_schemer/openapi31/vocab/base.rb', line 9 def validate(instance, instance_location, keyword_location, context) nested = [] parsed.each_with_index do |subschema, index| if ref_schema = subschema.parsed['$ref']&.ref_schema next if skip_ref_once == ref_schema.absolute_keyword_location ref_schema.parsed['discriminator']&.skip_ref_once = schema.absolute_keyword_location end nested << subschema.validate_instance(instance, instance_location, join_location(keyword_location, index.to_s), context) end result(instance, instance_location, keyword_location, nested.all?(&:valid), nested) ensure self.skip_ref_once = nil end |