Key-Value dictionnary validator.
This validator allows validating serialized (or deserialized) JSON values. An valid JSON value is a serializable/deserializable key-value dictionnary.
Usage: Let validator = DictValidator()
, then
* validator.validate('{"foo":0.5}') -> {"foo":0.5}
* validator.validate('{"foo":0.5,"bar":[1,2,3]}') -> {"foo":0.5,"bar":[1,2,3]}
* validator.validate('foo') -> ValueError
* validator.validate('True) -> ValueError
* validator.validate(''false') -> ValueError
* validator.validate(''5.5') -> ValueError
* validator.validate('[5.5,3]') -> ValueError
* validator.validate([5.5,3]) -> ValueError
Functions
Initialize self. See help(type(self)) for accurate signature.
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
type_ | Union |
Valitates a value.
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
value | Union | The value to validate an instance of `bool`, `int`, `float`, `str` or serilaizable `list`, `dict` |
Return type:
Any |