ListValidator
Array validator.
This validator allows validating serialized (or deserialized) array parameter values. A valid array is a serializable/deserializable list of (str, int, float, bool, array).
Usage: Let validator = ListValidator()
, then
* validator.validate([5.5,3]) -> [5.5,3]
* validator.validate('[5.5,3]') -> [5.5,3]
* validator.validate('[5.5,3,["foo","bar"]]') -> [5.5,3,["foo","bar"]]
* validator.validate('[5.5,3,{"foo":1.2}]') -> [5.5,3,{"foo":1.2}]
* validator.validate('foo') -> ValueError
* validator.validate(True) -> ValueError
* validator.validate('false') -> ValueError
* validator.validate('5.5') -> ValueError
* validator.validate('{"foo":1.2}') -> ValueError
Attributes
max_number_of_occurrences: int
min_number_of_occurrences: int
Functions
Initialize self. See help(type(self)) for accurate signature.
Name | Type | Default value | Description |
---|---|---|---|
min_number_of_occurrences | int | -1 | |
max_number_of_occurrences | int | -1 | |
allowed_values | list |
Name | Type | Default value | Description |
---|---|---|---|
type_ | Union |
Valitates a value.
Name | Type | Default value | Description |
---|---|---|---|
value | Union | The value to validate an instance of `bool`, `int`, `float`, `str` or serilaizable `list`, `dict` |
Any |