I find it quite common that you want to have constraints on an optional attribute.
This differs from example Ruby on Rails where validators instead have the option.
The goal of is to provide a cross framework and cross language way of validating data.
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.
Just remember to not include the attribute name since it's automatically prepended to the error message.
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).
There is also a Travis project used for testing, a Coveralls project used to code coverage as well as the annotated source.