Permalink
Browse files

Change the way the ‘maxItems’ attribute reports errors

  • Loading branch information...
1 parent 2423b2d commit 70e4ac7780372ab0082346b839fa7532a64cc731 @Baggz committed Mar 12, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/engines/json/attributes/maxItems.js
@@ -2,13 +2,13 @@
* MaxItems
*/
Validation.prototype.addAttributeConstructor('maxItems', function maxItemsConstructor() {
-
return function maxItems(property, propertyValue, attributeValue, propertyAttributes, callback) {
- if (isArray(propertyValue) && propertyValue.length <= attributeValue) {
- return callback();
- } else {
- return callback(true);
+
+ if (isArray(propertyValue) && propertyValue.length > attributeValue) {
+ this.addError();
}
- };
+ return callback();
+
+ };
});

0 comments on commit 70e4ac7

Please sign in to comment.