Permalink
Browse files

[api] Add support for custom messages in property's schema

  • Loading branch information...
1 parent ba7a8b4 commit 80c3c0387d553ad015d46115be3fb406b821a153 @pksunkara pksunkara committed Apr 11, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/revalidator.js
View
@@ -323,7 +323,9 @@
};
function error(attribute, property, actual, schema, errors) {
- var message = validate.messages && validate.messages[property] || "no default message";
+ var message = schema.message ? (typeof schema.message === 'string' ? schema.message : schema.message[attribute]) :
+ (validate.messages && validate.messages[property] || "no default message");
+
errors.push({
attribute: attribute,
property: property,

0 comments on commit 80c3c03

Please sign in to comment.