'Validates the parameter.
This method validates if the parameter\'s schema is valid,
and if the default value - if present - or the user-provided
value for the parameter comply with the schema.'

def validate(self, validate_value=True, context=None, template=None):

    err_msg = _("Parameter    '%(name)s'    is    invalid:    %(exp)s")
    try:
        self.schema.validate(context)
        if (not validate_value):
            return
        if (self.user_value is not None):
            self._validate(self.user_value, context, template)
        elif self.has_default():
            self._validate(self.default(), context, template)
        else:
            raise exception.UserParameterMissing(key=self.name)
    except exception.StackValidationFailed as ex:
        msg = (err_msg % dict(name=self.name, exp=six.text_type(ex)))
        raise exception.StackValidationFailed(message=msg)
    except exception.InvalidSchemaError as ex:
        msg = (err_msg % dict(name=self.name, exp=six.text_type(ex)))
        raise exception.InvalidSchemaError(message=msg)
