Skip to content

Email schema validator created from validx Str and Django EmailValidator

Notifications You must be signed in to change notification settings

mathbeal/email_validx_django

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Validx library defines new types like Str, Int, Dict. It helps validate a schema in a pleasant way.

The Email type is not defined. As I needed it with django, I subclass Str to create an Email schema.

Usage

schema = Dict({
    'name': Str(),
    'email': Email(),
})

valid_json = {
    'name': 'Toto',
    'email': 'toto@gmail.com',
}

invalid_json = {
    'name': 'Toto',
    'email': 'toto@@gmail.com',
}

schema(valid_json)  # json is valid, no exception raised.
schema(invalid_json)  # raise validx.exc.errors.PatternMatchError.

About

Email schema validator created from validx Str and Django EmailValidator

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages