New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Consider adding 'email' as a core type #29

Closed
boosh opened this Issue Feb 16, 2014 · 4 comments

Comments

Projects
None yet
2 participants
@boosh
Copy link

boosh commented Feb 16, 2014

It'd be useful if cerberus had 'email' as a core type so users don't have to find a regex to validate emails, etc. It's just a small thing to do, but given how almost every web app will want to validate email addresses, it'd speed up using the library if it was core type. Otherwise users have to learn how to add custom types, write a regex, etc. Adding a 'regex' parameter to the string type would also be useful.

Just a small thing, but I think it'd be helpful.

@nicolaiarocci

This comment has been minimized.

Copy link
Member

nicolaiarocci commented Feb 17, 2014

Yeah I agree that it would be nice to have. Only problem being, no matter how good the regex people will always complain that it isn't good enough :)

This is one of those fields where I feel that customization comes in really handy, as anyone can work out his/her own use case, relying on email validatio APIs included (you could call the API in your custom validation function for example).

Of course we could still provide a standard email validation rule, which people could then choose to override if so they wish. A standard email validation rule would also be nice to have in Eve.

@boosh

This comment has been minimized.

Copy link

boosh commented Feb 17, 2014

I agree. A standard email validator would let people get up-and-running quickly. If it took a regex as a parameter then people could override that as necessary.

I also think that a regex attribute on the string validator could be useful - in fact, the email validator could then just call the string validator and supply a default email regex.

BTW - Mailgun released their validation tool: https://github.com/mailgun/flanker

@nicolaiarocci

This comment has been minimized.

Copy link
Member

nicolaiarocci commented Apr 23, 2014

I added a regex validation rule instead, which of course makes email validation a snap (see the test, or the documentation example).

@boosh

This comment has been minimized.

Copy link

boosh commented Apr 23, 2014

Great, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment