Sha256: 63806727eb17e3996216978a1889d12fe7242ab98480fcb1ecb42457019c56e0

Contents?: true

Size: 581 Bytes

Versions: 26

Compression:

Stored size: 581 Bytes

Contents

module Schemacop
  module V3
    class AllOfNode < CombinationNode
      def type
        :allOf
      end

      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

      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
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
schemacop-3.0.19 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.18 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.17 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.16 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.15 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.14 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.13 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.12 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.11 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.10 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.9 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.8 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.7 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.6 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.5 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.4 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.3 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.2 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.1 lib/schemacop/v3/all_of_node.rb
schemacop-3.0.0 lib/schemacop/v3/all_of_node.rb