def modify_schema_allow_default_none(schema):
    """
    Manipulate the provided schema so None is also an allowed value for each attribute which
    defines a default value of None.
    """
    schema = fast_deepcopy_dict(schema)
    properties = schema.get("properties", {})

    for property_name, property_data in six.iteritems(properties):
        is_optional = not property_data.get("required", False)
        has_default_value = "default" in property_data
        default_value = property_data.get("default", None)
        property_schema = schema["properties"][property_name]

        if (has_default_value or is_optional) and default_value is None:
            # If property is anyOf and oneOf then it has to be process differently.
            if is_property_type_anyof(property_schema) and not is_property_nullable(
                property_schema["anyOf"]
            ):
                property_schema["anyOf"].append({"type": "null"})
            elif is_property_type_oneof(property_schema) and not is_property_nullable(
                property_schema["oneOf"]
            ):
                property_schema["oneOf"].append({"type": "null"})
            elif is_property_type_list(property_schema) and not is_property_nullable(
                property_schema.get("type")
            ):
                property_schema["type"].append("null")
            elif is_property_type_single(property_schema) and not is_property_nullable(
                property_schema.get("type")
            ):
                property_schema["type"] = [
                    property_schema.get("type", "string"),
                    "null",
                ]

        # Support for nested properties (array and object)
        attribute_type = property_data.get("type", None)
        schema_items = property_data.get("items", {})

        # Array
        if (
            is_attribute_type_array(attribute_type)
            and schema_items
            and schema_items.get("properties", {})
        ):
            array_schema = schema_items
            array_schema = modify_schema_allow_default_none(schema=array_schema)
            schema["properties"][property_name]["items"] = array_schema

        # Object
        if is_attribute_type_object(attribute_type) and property_data.get(
            "properties", {}
        ):
            object_schema = property_data
            object_schema = modify_schema_allow_default_none(schema=object_schema)
            schema["properties"][property_name] = object_schema

    return schema

    Manipulate the provided schema so None is also an allowed value for each attribute which
    defines a default value of None.
    
st2common/st2common/util/schema/__init__.py