@@ -293,6 +293,8 @@ class Validator {
293
293
// Issue: parse can fail on decimal but menu has "Missing"
294
294
if ( parsed === undefined ) {
295
295
parse_error = `Value does not match format for ${ slotType . uri } ` ;
296
+ // We do not process any nested anyOf, allOf, etc.
297
+ return parse_error
296
298
297
299
//if (!(anyOfValidators.length || allOfValidators.length || exactlyOneOfValidators.length || noneOfValidators.length)) {
298
300
// return parse_error;
@@ -345,11 +347,6 @@ class Validator {
345
347
const results = anyOfValidators . map ( ( fn ) => fn ( value ) ) ;
346
348
const valid = results . some ( ( result ) => result === undefined ) ;
347
349
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
- }
353
350
return results . join ( '\n' ) ;
354
351
}
355
352
}
@@ -386,17 +383,21 @@ class Validator {
386
383
}
387
384
}
388
385
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
+ // }
400
401
}
401
402
} ;
402
403
0 commit comments