From 28e1494ccce330ba2adede39212edbbf6ad5c333 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Mon, 11 Jan 2016 13:25:39 -0800 Subject: [PATCH] Correct validation with an empty array --- raml-validate.js | 2 +- test.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/raml-validate.js b/raml-validate.js index 2107d4b..8a97f92 100644 --- a/raml-validate.js +++ b/raml-validate.js @@ -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) { diff --git a/test.js b/test.js index 9dbc52e..b8f1b00 100644 --- a/test.js +++ b/test.js @@ -862,6 +862,21 @@ var TESTS = [ key: 'param', attr: 'unknown' }] + ], + /** + * Regressions. + */ + [ + { + param: { + type: 'string', + repeat: true, + required: false + } + }, + { param: [] }, + true, + [] ] ];