def match_to_instance(instance)
      # matching oneOf is good here. one schema for one instance.
      # matching anyOf is okay. there could be more than one schema matched. it's often just one. if more
      #   than one is a match, the problems of allOf occur.
      # matching allOf is questionable. all of the schemas must be matched but we just return the first match.
      #   there isn't really a better answer with the current implementation. merging the schemas together
      #   is a thought but is not practical.
      instance = instance.deref if instance.is_a?(JSI::JSON::Node)
      %w(oneOf allOf anyOf).select { |k| schema_node[k].respond_to?(:to_ary) }.each do |someof_key|
        schema_node[someof_key].map(&:deref).map do |someof_node|
          someof_schema = self.class.new(someof_node)
          if someof_schema.validate(instance)
            return someof_schema.match_to_instance(instance)
          end
        end
      end
      return self
    end
def match_to_instance(instance)
      # matching oneOf is good here. one schema for one instance.
      # matching anyOf is okay. there could be more than one schema matched. it's often just one. if more
      #   than one is a match, the problems of allOf occur.
      # matching allOf is questionable. all of the schemas must be matched but we just return the first match.
      #   there isn't really a better answer with the current implementation. merging the schemas together
      #   is a thought but is not practical.
      instance = instance.deref if instance.is_a?(JSI::JSON::Node)
      %w(oneOf allOf anyOf).select { |k| schema_node[k].respond_to?(:to_ary) }.each do |someof_key|
        schema_node[someof_key].map(&:deref).map do |someof_node|
          someof_schema = self.class.new(someof_node)
          if someof_schema.validate(instance)
            return someof_schema.match_to_instance(instance)
          end
        end
      end
      return self
    end
if this schema is a oneOf, allOf, anyOf schema, #match_to_instance finds
 one of the subschemas that matches the given instance and returns it. if
 there are no matching *Of schemas, this schema is returned.

 @param instance [Object] the instance to which to attempt to match *Of subschemas
 @return [JSI::Schema] a matched subschema, or this schema (self)