jsonvalidate

WIP

MIT License

Downloads
173
Stars
6
Committers
3

JSON Validation Schema

JSON Validation Schema

Features

from jsonvalidate import Object, String, Integer

schema = Object({
    'email': String(regex='[^@]+@[^@]+\.[^@]+'),
    'name': String(),
    'age': Integer(enums=[5, 6, 7]),
    'address': Object({
        'permanent': String(),
        'temporary': String(min_length=3, enums=['asss', 's'])
    })
})

payload = {
    'email': '[email protected]',
    'name': 'robus',
    'age': 342,
    'address': {
        'permanent': 'sd',
        'temporary': 'asss'
    }

}

print(schema.check(payload))