Skip to content

Commit 9c356d7

Browse files
committed
Logic change in Validator.js
1 parent c191a27 commit 9c356d7

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

lib/Validator.js

+17-16
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ class Validator {
293293
// Issue: parse can fail on decimal but menu has "Missing"
294294
if (parsed === undefined) {
295295
parse_error = `Value does not match format for ${slotType.uri}`;
296+
// We do not process any nested anyOf, allOf, etc.
297+
return parse_error
296298

297299
//if (!(anyOfValidators.length || allOfValidators.length || exactlyOneOfValidators.length || noneOfValidators.length)) {
298300
// return parse_error;
@@ -345,11 +347,6 @@ class Validator {
345347
const results = anyOfValidators.map((fn) => fn(value));
346348
const valid = results.some((result) => result === undefined);
347349
if (!valid) {
348-
// If every condition gives format error, just return one error
349-
// TODO does this apply in allOf, second branch of exactlyOneOf?
350-
if (results.every((result) => result === parse_error)) {
351-
return parse_error;
352-
}
353350
return results.join('\n');
354351
}
355352
}
@@ -386,17 +383,21 @@ class Validator {
386383
}
387384
}
388385

389-
if (
390-
anyOfValidators.length ||
391-
allOfValidators.length ||
392-
exactlyOneOfValidators.length ||
393-
noneOfValidators.length
394-
) {
395-
// We passed validation here which means a parse error can be overriden
396-
} else if (parse_error.length) {
397-
//There were no other ranges besides basic slotType so
398-
return parse_error;
399-
}
386+
// The below code seems to imply that we can ignore parse errors, as
387+
// long as nested anyOfs, allOfs, etc. are valid. The test suite seems
388+
// to want something different, so we now return parse error
389+
// immediately.
390+
// if (
391+
// anyOfValidators.length ||
392+
// allOfValidators.length ||
393+
// exactlyOneOfValidators.length ||
394+
// noneOfValidators.length
395+
// ) {
396+
// // We passed validation here which means a parse error can be overriden
397+
// } else if (parse_error.length) {
398+
// //There were no other ranges besides basic slotType so
399+
// return parse_error;
400+
// }
400401
}
401402
};
402403

0 commit comments

Comments
 (0)