Browse Source

proper fix for validator locales

flowchartTest
AlexDM0 9 years ago
parent
commit
8ab51a7378
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      lib/shared/Validator.js

+ 7
- 3
lib/shared/Validator.js View File

@ -56,9 +56,13 @@ class Validator {
} }
else if (referenceOptions[option] === undefined && referenceOptions.__any__ !== undefined) { else if (referenceOptions[option] === undefined && referenceOptions.__any__ !== undefined) {
// __any__ is a wildcard. Any value is accepted and will be further analysed by reference. // __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); Validator.checkFields(option, options, referenceOptions, '__any__', referenceOptions['__any__'].__type__, path);
} }
else {
Validator.checkFields(option, options, referenceOptions, '__any__', referenceOptions['__any__'], path);
}
} }
else { 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. // 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); ' Allowed values are:' + Validator.print(refOptionType) + ' not "' + options[option] + '". ' + Validator.printLocation(path, option), printStyle);
errorFound = true; errorFound = true;
} }
else if (optionType === 'object') {
else if (optionType === 'object' && referenceOption !== "__any__") {
path = util.copyAndExtendArray(path, option); path = util.copyAndExtendArray(path, option);
Validator.parse(options[option], referenceOptions[referenceOption], path); Validator.parse(options[option], referenceOptions[referenceOption], path);
} }
} }
else if (optionType === 'object') {
else if (optionType === 'object' && referenceOption !== "__any__") {
path = util.copyAndExtendArray(path, option); path = util.copyAndExtendArray(path, option);
Validator.parse(options[option], referenceOptions[referenceOption], path); Validator.parse(options[option], referenceOptions[referenceOption], path);
} }

Loading…
Cancel
Save