Skip to content

Commit

Permalink
fix(designer): Have better validaiton for array values in parameters (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hartra344 committed Feb 20, 2024
1 parent 94bcc06 commit 4ea8d9d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/designer/src/lib/core/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,12 @@ function isValidJSONObjectFormat(value: string): boolean {
}

function isValidArrayFormat(value: string): boolean {
const trimmedValue = (value || '').trim();
return startsWith(trimmedValue, '[') && endsWith(trimmedValue, ']');
try {
const v = JSON.parse(value);
return typeof v === 'object' && Array.isArray(v) && v.every((item) => item !== undefined && item !== null);
} catch (e) {
return false;
}
}

export const isISO8601 = (s: string) => {
Expand Down

0 comments on commit 4ea8d9d

Please sign in to comment.