Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 162025d

Browse files
chesterkmrtomer-shvadron
andauthoredJun 6, 2024··
fix: fixed validation errors duplicates (#2368)
Co-authored-by: Tomer Shvadron <[email protected]>
1 parent e340705 commit 162025d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎apps/kyb-app/src/components/organisms/DynamicUI/rule-engines/json-schema.rule-engine.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { AnyObject } from '@ballerine/ui';
77
import ajvErrors from 'ajv-errors';
88
import addFormats, { FormatName } from 'ajv-formats';
99
import Ajv, { ErrorObject } from 'ajv/dist/2019';
10+
import uniqBy from 'lodash/uniqBy';
1011

1112
export class JsonSchemaRuleEngine implements RuleEngine {
1213
static ALLOWED_FORMATS: FormatName[] = ['email', 'uri', 'date', 'date-time'];
@@ -74,7 +75,10 @@ export class JsonSchemaRuleEngine implements RuleEngine {
7475
return fieldErrors;
7576
});
7677

77-
return result?.flat()?.filter(result => Boolean(result.message));
78+
return uniqBy(
79+
result?.flat()?.filter(result => Boolean(result.message)),
80+
'message',
81+
);
7882
}
7983

8084
private buildFieldDestination(

0 commit comments

Comments
 (0)
Please sign in to comment.