Skip to content

Commit

Permalink
fix: Prevented duplicate select values to go into AJV Schema (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
chavda-bhavik authored Oct 13, 2023
2 parents 0942663 + 2de1ad4 commit 7a3bcb6
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,14 @@ export class DoReview {
};
break;
case ColumnTypesEnum.SELECT:
const selectValues =
Array.isArray(column.selectValues) && column.selectValues.length > 0
? [...column.selectValues, ...(column.isRequired ? [] : [''])]
: [];
property = {
type: 'string',
enum: Array.from(new Set(selectValues)), // handle duplicate
...(!column.isRequired && { default: '' }),
...(Array.isArray(column.selectValues) &&
column.selectValues.length > 0 && {
enum: [...column.selectValues, ...(column.isRequired ? [] : [''])],
}),
};
break;
case ColumnTypesEnum.REGEX:
Expand Down

0 comments on commit 7a3bcb6

Please sign in to comment.