From 8ab51a7378d2d7700ea53c594e0e20b1742215ca Mon Sep 17 00:00:00 2001 From: AlexDM0 Date: Thu, 11 Jun 2015 10:54:19 +0200 Subject: [PATCH] proper fix for validator locales --- lib/shared/Validator.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/shared/Validator.js b/lib/shared/Validator.js index af72dcd6..70412c24 100644 --- a/lib/shared/Validator.js +++ b/lib/shared/Validator.js @@ -56,9 +56,13 @@ class Validator { } else if (referenceOptions[option] === undefined && referenceOptions.__any__ !== undefined) { // __any__ is a wildcard. Any value is accepted and will be further analysed by reference. - if (Validator.getType(options[option]) === 'object') { + if (Validator.getType(options[option]) === 'object' && referenceOptions['__any__'].__type__ !== undefined) { + // if the any subgroup is not a predefined object int he configurator we do not look deeper into the object. Validator.checkFields(option, options, referenceOptions, '__any__', referenceOptions['__any__'].__type__, path); } + else { + Validator.checkFields(option, options, referenceOptions, '__any__', referenceOptions['__any__'], path); + } } else { // Since all options in the reference are objects, we can check whether they are supposed to be object to look for the __type__ field. @@ -92,12 +96,12 @@ class Validator { ' Allowed values are:' + Validator.print(refOptionType) + ' not "' + options[option] + '". ' + Validator.printLocation(path, option), printStyle); errorFound = true; } - else if (optionType === 'object') { + else if (optionType === 'object' && referenceOption !== "__any__") { path = util.copyAndExtendArray(path, option); Validator.parse(options[option], referenceOptions[referenceOption], path); } } - else if (optionType === 'object') { + else if (optionType === 'object' && referenceOption !== "__any__") { path = util.copyAndExtendArray(path, option); Validator.parse(options[option], referenceOptions[referenceOption], path); }