Validating an email address exists

Posted by / 23-Aug-2017 17:59

Validating an email address exists

The validation constraints can be declared in JSON and shared between clients and the server. One thing that is a bit unorthodox is that most validators will consider undefined values (,) valid values.

So for example adding a constraint of at least 6 characters will be like saying If the attribute is given it must be at least 6 characters.

Unless otherwise specified you can always specify the message option to customize the message returned if the validator doesn't pass.

One example would be to check if a username is already used by asking the server.

The implementation is fairly basic and doesn't do anything clever with the messages.

It doesn't support things like only validating a sub key if the parent key is present so for more advanced validations multiple validation schemas are recommended. Most validators allow you to specify default messages in addition to default options, refer to the documentation for the individual validators for information on how to do this.

provides a declarative way of validating javascript objects.

It is unit tested with 100% code coverage and can be considered fit for production.

validating an email address exists-45validating an email address exists-12validating an email address exists-36

The message can also be a function which will be called to retrieve the message, besides this it is treated like a normal message (the attribute name is prepended etc).

One thought on “validating an email address exists”