dynamic messages for validators #1936

Open
ghost opened this Issue Feb 23, 2014 · 0 comments

Comments

Projects
None yet
0 participants
@ghost

ghost commented Feb 23, 2014

Hi, I'd like to just add something like :

 validator.call(scope, value, function (ok, customMessage) {
          validate(ok, customMessage || message, type, value);
        });

to schematypes.js > doValidate to support more useful error messages or more complex business logic. Can you see any problem with this?

eg:

validator : function(val, next) {
  if (val === 'something complex') {
    next(false, 'complex problem at {PATH}');
  }
  next(false);
},
msg : 'default fail'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment