Python dict validator.
{
"key1": <Definition>,
"key2": <Definition>,
...
}
A definition is one of these three forms:
<Meta>
(<Meta>, <Param>)
[<Meta>,(<Meta>, <Param>),...]
A meta is an instance of one of these classes:
<TypeStr> | <Validator> | <Schema>
{
"required"?: <boolean>, //default is True
"allow_none"?: <boolean>, //default is False
"verbose_name"?: <string>,
...
(some meta specific params)
...
}
A TypeStr
can be a basic type string:
'any' | 'str' | 'int' | 'float' | 'bool' | 'number' | 'enum'
or:
'array'
or a basic type string with a []
, such as:
'any[]' | 'str[]' | 'int[]'
definition: a definition (see above)
basic_type: a basic type string
max_length: an integer
basic_type: a basic type string
max_length: an integer
max: the upper limit (<=)
min: the lower limit (>=)
max: the upper limit (<=)
min: the lower limit (>=)
items: a list contain the possible values, default as []