ConstrainedIntValidator
This class validates integer values against a set of configurable constraints, including strict type checking and range boundaries. It supports enforcing minimum and maximum limits through inclusive or exclusive thresholds, as well as verifying that values are multiples of a specific integer.
Attributes
| Attribute | Type | Description |
|---|---|---|
| strict | bool | Determines whether the validator enforces strict integer type checking or allows coercion from other types. |
| multiple_of | [Int](../../input/return/enums/int.md?sid=input_return_enums_int) | Constraint requiring the integer to be a multiple of this specific value. |
| le | [Int](../../input/return/enums/int.md?sid=input_return_enums_int) | Inclusive upper bound constraint that requires the integer to be less than or equal to this value. |
| lt | [Int](../../input/return/enums/int.md?sid=input_return_enums_int) | Exclusive upper bound constraint that requires the integer to be strictly less than this value. |
| ge | [Int](../../input/return/enums/int.md?sid=input_return_enums_int) | Inclusive lower bound constraint that requires the integer to be greater than or equal to this value. |
| gt | [Int](../../input/return/enums/int.md?sid=input_return_enums_int) | Exclusive lower bound constraint that requires the integer to be strictly greater than this value. |
Constructor
Signature
def ConstrainedIntValidator(
strict: bool = false,
multiple_of: Optional[int] = None,
le: Optional[int] = None,
lt: Optional[int] = None,
ge: Optional[int] = None,
gt: Optional[int] = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| strict | bool = false | Whether to strictly validate the integer type. |
| multiple_of | Optional[int] = None | The value that the input integer must be a multiple of. |
| le | Optional[int] = None | The maximum inclusive value (less than or equal to). |
| lt | Optional[int] = None | The maximum exclusive value (less than). |
| ge | Optional[int] = None | The minimum inclusive value (greater than or equal to). |
| gt | Optional[int] = None | The minimum exclusive value (greater than). |
Signature
def ConstrainedIntValidator(
strict: bool = false,
multiple_of: Optional[int] = None,
le: Optional[int] = None,
lt: Optional[int] = None,
ge: Optional[int] = None,
gt: Optional[int] = None
)
Parameters
| Name | Type | Description |
|---|---|---|
| strict | bool = false | Whether to enforce strict integer type checking and disallow numeric-like strings or floats. |
| multiple_of | Optional[int] = None | A value that the input integer must be an exact multiple of. |
| le | Optional[int] = None | The inclusive upper bound (less than or equal to) for the input value. |
| lt | Optional[int] = None | The exclusive upper bound (less than) for the input value. |
| ge | Optional[int] = None | The inclusive lower bound (greater than or equal to) for the input value. |
| gt | Optional[int] = None | The exclusive lower bound (greater than) for the input value. |