def METHOD_NAME(self, obj, field):
    has_yaml_option = False
    schemas = []
    for field_item in field._union_fields:  # pylint: disable=protected-access
        if isinstance(field_item, fields.Nested) and isinstance(field_item.schema, YamlFileSchema):
            has_yaml_option = True
        schemas.append(self._get_schema_for_field(obj, field_item))
    if has_yaml_option:
        schemas.append({"type": "string", "pattern": "^file:.*"})
    if field.allow_none:
        schemas.append({"type": "null"})
    if field.is_strict:
        schema = {"oneOf": schemas}
    else:
        schema = {"anyOf": schemas}
    # This happens in the super() call to get_schema, doing here to allow for adding
    # descriptions and other schema attributes from marshmallow metadata
    metadata = field.metadata.get("metadata", {})
    for md_key, md_val in metadata.items():
        if md_key in ("metadata", "name"):
            continue
        schema[md_key] = md_val
    return schema