gateguard

Schema-based validation package


Keywords
validate, validation, dict, json, data, protect, schema
License
MIT
Install
pip install gateguard==1.3.2

Documentation

Gateguard

Schema-based validation package

Build Status Coverage Status PyPI Documentation Status

Installation

pip install gateguard

Usage

from gateguard import Schema, IntegerField, StringField


class MySchema(Schema):

    pk = IntegerField(min_value=1)
    name = StringField(required=False)
    surname = StringField(max_length=20)

data = {
    'pk': 'p',
    'name': 'Milli',
}

try:
    MySchema.validate(data)
except MySchema.ValidationError as e:
    print(e.error)

>>> {"pk": "Value must be a valid integer", "surname": "Value is required"}

Documentation

Read the Docs

Tests

tox

Changelog

See releases

License

See LICENSE