Login
Back to bricks list
Introduction Version

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: intmin_number_of_occurrences: int

Functions

__INIT__

Initialize self. See help(type(self)) for accurate signature.

Parameters:
NameTypeDefault valueDescription
min_number_of_occurrencesint -1
max_number_of_occurrencesint -1
allowed_valueslist
SET_TYPE
Parameters:
NameTypeDefault valueDescription
type_Union
VALIDATE

Valitates a value.

Parameters:
NameTypeDefault valueDescription
valueUnion The value to validate an instance of `bool`, `int`, `float`, `str` or serilaizable `list`, `dict`
Return type:
Any