Class: Schemacop::V3::AllOfNode
- Inherits:
-
CombinationNode
- Object
- Node
- CombinationNode
- Schemacop::V3::AllOfNode
- Defined in:
- lib/schemacop/v3/all_of_node.rb
Instance Attribute Summary
Attributes inherited from Node
#as, #default, #description, #name, #options, #parent, #title
Instance Method Summary collapse
Methods inherited from CombinationNode
#add_child, #as_json, dsl_methods, #init
Methods inherited from Node
allowed_options, #allowed_types, #as_json, #children, create, #create, dsl_methods, #dsl_node, #dsl_scm, #init, #initialize, #required?, resolve_class, #schemas, supports_children, supports_children_options, #used_external_schemas, #validate
Constructor Details
This class inherits a constructor from Schemacop::V3::Node
Instance Method Details
#_validate(data, result:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/schemacop/v3/all_of_node.rb', line 8 def _validate(data, result:) super_data = super return if super_data.nil? matches = matches(super_data) if matches.size != @items.size result.error <<~PLAIN.strip Matches #{matches.size} schemas but should match all of them: #{(data).join("\n")} PLAIN end end |
#cast(value) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/schemacop/v3/all_of_node.rb', line 22 def cast(value) items = matches(value) return value unless items casted_value = value.dup items.each { |i| casted_value = i.cast(casted_value) } return casted_value end |
#type ⇒ Object
4 5 6 |
# File 'lib/schemacop/v3/all_of_node.rb', line 4 def type :allOf end |