schema in python dictionary for mongodb and api

0 votes
7 views
asked Dec 12, 2017 by django_learner (116 points)

i have a python dictionary which is meant to run an api using mongodb as a backend. One of the schema goes like this.

users = {
    'schema': {
        'firstname': {
            'type': 'string',
            'minlength': 1,
            'maxlength': 10,
        },
        'lastname': {
            'type': 'string',
            'minlength': 1,
            'maxlength': 15,
            'required': True,
            'unique': True,
        },
        'role': {
            'type': 'list',
            'allowed': ["author", "contributor", "copy"],
        },
        'born': {
            'type': 'datetime',
        },
    }
}

Is there any package in django , flask or python that deal with this kind of schema to run REST API ?

Please log in or register to answer this question.

...