Skip to content

Commit

Permalink
Invalid formats should pass
Browse files Browse the repository at this point in the history
  • Loading branch information
tdegrunt committed Mar 1, 2015
1 parent 0da9b1d commit 14a8429
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ exports.isFormat = function isFormat (input, format) {
return FORMAT_REGEXPS[format](input);
}
}
return false;
return true;
};

var makeSuffix = exports.makeSuffix = function makeSuffix (key) {
Expand Down Expand Up @@ -261,4 +261,4 @@ exports.encodePath = function encodePointer(a){
// ~ must be encoded explicitly because hacks
// the slash is encoded by encodeURIComponent
return a.map(function(v){ return '/'+encodeURIComponent(v).replace(/~/g,'%7E'); }).join('');
}
};
6 changes: 6 additions & 0 deletions test/formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,10 @@ describe('Formats', function () {
this.validator.validate("1test!", {'type': 'string', 'format': 'alphanumeric'}).valid.should.be.false;
});
});

describe('invalid format', function() {
it('should validate', function () {
this.validator.validate("url", {'type': 'string', 'format': 'url'}).valid.should.be.true;
});
});
});

0 comments on commit 14a8429

Please sign in to comment.