Sha256: c09d4e64fd1e49f178eefa3e5b52aaba4f7f9c77fedd7f1cc2489a796a4297fb
Contents?: true
Size: 622 Bytes
Versions: 17
Compression:
Stored size: 622 Bytes
Contents
module Schemacop module V3 class OneOfNode < CombinationNode def type :oneOf end def _validate(data, result:) super_data = super return if super_data.nil? matches = matches(super_data) if matches.size == 1 matches.first._validate(super_data, result: result) else result.error "Matches #{matches.size} definitions but should match exactly 1." end end def validate_self if @items.size < 2 fail 'Node "one_of" makes only sense with at least 2 items.' end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems