@@ -384,7 +384,7 @@ export class ValidationService {
384
384
385
385
if ( ! subFieldErrors . some ( subFieldError => Object . keys ( subFieldError ) . length === 0 ) ) {
386
386
fieldErrors [ parent + name ] = {
387
- message : `Could not match the union against any of the items. Issues: ${ subFieldErrors } ` ,
387
+ message : `Could not match the union against any of the items. Issues: ${ JSON . stringify ( subFieldErrors ) } ` ,
388
388
value,
389
389
} ;
390
390
return ;
@@ -420,16 +420,18 @@ export class ValidationService {
420
420
} ) ;
421
421
422
422
subFieldErrors . forEach ( subFieldError => {
423
- ( Object as any ) . entries ( subFieldError ) . forEach ( ( [ key , value ] ) => {
423
+ Object . entries ( subFieldError ) . forEach ( ( [ key , value ] ) => {
424
424
if ( value . message . includes ( 'excess' ) ) {
425
425
delete subFieldError [ key ] ;
426
426
}
427
427
} ) ;
428
428
} ) ;
429
429
430
- if ( subFieldErrors . some ( subFieldError => Object . keys ( subFieldError ) . length !== 0 ) ) {
430
+ const filtered = subFieldErrors . filter ( subFieldError => Object . keys ( subFieldError ) . length !== 0 ) ;
431
+
432
+ if ( filtered . length > 0 ) {
431
433
fieldErrors [ parent + name ] = {
432
- message : `Could not match the intersection against every type. Issues: ${ subFieldErrors } ` ,
434
+ message : `Could not match the intersection against every type. Issues: ${ JSON . stringify ( filtered ) } ` ,
433
435
value,
434
436
} ;
435
437
return ;
@@ -571,6 +573,7 @@ export class ValidationService {
571
573
572
574
return value ;
573
575
}
576
+ }
574
577
575
578
export interface IntegerValidator {
576
579
isInt ?: { errorMsg ?: string } ;
0 commit comments