(datum, schema, named_schemas, parent_ns=None, raise_errors=True)
return False
Check that the data is a list type with possible options to
    validate as True.

    Parameters
    ----------
    datum: Any
        Data being validated
    schema: dict
        Schema
    parent_ns: str
        parent namespace
    raise_errors: bool
        If true, raises ValidationError on invalid data
Check that the data is a list type with possible options to
    validate as True.
Check that the data is a list type with possible options to validate as True .
def validate_union(datum, schema, named_schemas, parent_ns=None, raise_errors=True):
    """
    Check that the data is a list type with possible options to
    validate as True.

    Parameters
    ----------
    datum: Any
        Data being validated
    schema: dict
        Schema
    parent_ns: str
        parent namespace
    raise_errors: bool
        If true, raises ValidationError on invalid data
    """
    if isinstance(datum, tuple):
        (name, datum) = datum
        for candidate in schema:
            if extract_record_type(candidate) == "record":
                schema_name = candidate["name"]
            else:
                schema_name = candidate
            if schema_name == name:
                return _validate(
                    datum,
                    schema=candidate,
                    named_schemas=named_schemas,
                    field=parent_ns,
                    raise_errors=raise_errors,
                )
        else:
            return False

    errors = []
    for s in schema:
        try:
            ret = _validate(
                datum,
                schema=s,
                named_schemas=named_schemas,
                field=parent_ns,
                raise_errors=raise_errors,
            )
            if ret:
                # We exit on the first passing type in Unions
                return True
        except ValidationError as e:
            errors.extend(e.errors)
    if raise_errors:
        raise ValidationError(*errors)
    return False
def validate_union ( datum , schema , named_schemas , parent_ns = None , raise_errors = True ) : if isinstance ( datum , tuple ) : ( name , datum ) = datum for candidate in schema : if extract_record_type ( candidate ) == "record" : schema_name = candidate [ "name" ] else : schema_name = candidate if schema_name == name : return _validate ( datum , schema = candidate , named_schemas = named_schemas , field = parent_ns , raise_errors = raise_errors , ) else : return False errors = [ ] for s in schema : try : ret = _validate ( datum , schema = s , named_schemas = named_schemas , field = parent_ns , raise_errors = raise_errors , ) if ret : # We exit on the first passing type in Unions return True except ValidationError as e : errors . extend ( e . errors ) if raise_errors : raise ValidationError ( * errors ) return False