Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Correct validation with an empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Jan 11, 2016
1 parent 739f6db commit 28e1494
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion raml-validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function toValidation (configs, rules, types) {
return toValidationObject(false, key, value, 'repeat', !isArray);
}

var response;
var response = toValidationObject(true, key, value);

validations.some(function (validation) {
var isType = values.every(function (userValue) {
Expand Down
15 changes: 15 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,21 @@ var TESTS = [
key: 'param',
attr: 'unknown'
}]
],
/**
* Regressions.
*/
[
{
param: {
type: 'string',
repeat: true,
required: false
}
},
{ param: [] },
true,
[]
]
];

Expand Down

0 comments on commit 28e1494

Please sign in to comment.