Class: Schemacop::V3::AllOfNode

Inherits:
CombinationNode show all
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
# File 'lib/schemacop/v3/all_of_node.rb', line 8

def _validate(data, result:)
  super_data = super
  return if super_data.nil?

  if matches(super_data).size != @items.size
    result.error 'Does not match all allOf conditions.'
  end
end

#cast(value) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/schemacop/v3/all_of_node.rb', line 17

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

#typeObject



4
5
6
# File 'lib/schemacop/v3/all_of_node.rb', line 4

def type
  :allOf
end