def get_schema_for_resource_parameters(
    parameters_schema, allow_additional_properties=False
):
    """
    Dynamically construct JSON schema for the provided resource from the parameters metadata.
    """

    def normalize(x):
        return {k: v if v else SCHEMA_ANY_TYPE for k, v in six.iteritems(x)}

    schema = {}
    properties = {}
    properties.update(normalize(parameters_schema))
    if properties:
        schema["type"] = "object"
        schema["properties"] = properties
        schema["additionalProperties"] = allow_additional_properties

    return schema

    Dynamically construct JSON schema for the provided resource from the parameters metadata.
    
st2common/st2common/util/schema/__init__.py