Skip to content

Commit

Permalink
Merge pull request #440 from ProcessMaker/bugfix/FOUR-14970-fall
Browse files Browse the repository at this point in the history
FOUR-14970 Add dot_notation validator
  • Loading branch information
ryancooley authored Oct 18, 2024
2 parents e7e83bc + 5d59506 commit ea0828a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/components/mixins/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,28 @@ export default {
},
"Must have a value between :between"
);

// Update screen builder's tests/e2e/specs/Builder.spec.js when changing this
Validator.register(
"dot_notation",
(path) => {
// Split the string by dots
const keys = path.split('.');

// Regular expression for valid keys: start with a letter, followed by letters, numbers, or underscores
const validKey = /^[a-zA-Z][a-zA-Z0-9_]*$/;

// Check each key for validity
for (let key of keys) {
if (!validKey.test(key)) {
return false;
}
}

return true;
},
"Invalid variable name",
);
}
}
};

0 comments on commit ea0828a

Please sign in to comment.