MinValueValidator
This class provides validation logic to ensure that a given value is greater than or equal to a specified minimum limit. It functions by comparing the input against a threshold and raising a validation error with a customizable message if the condition is not met.
Attributes
| Attribute | Type | Description |
|---|---|---|
| message | string = Ensure this value is greater than or equal to %(limit_value)s. | Ensure this value is greater than or equal to %(limit_value)s. |
| code | string = min_value | The error code string used to identify the validation failure in raised exceptions. |
Constructor
Signature
def MinValueValidator(
limit_value: Any,
message: str = null
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| limit_value | Any | The threshold value that the input must be greater than or equal to. |
| message | str = null | An optional custom error message to override the default. |
Methods
compare()
@classmethod
def compare(
a: Any,
b: Any
) - > boolean
Determines if the provided value is strictly less than the specified limit value.
Parameters
| Name | Type | Description |
|---|---|---|
| a | Any | The input value being validated for a minimum threshold. |
| b | Any | The limit value that the input must be greater than or equal to. |
Returns
| Type | Description |
|---|---|
boolean | True if the input value is less than the limit, indicating a validation failure; otherwise False. |