Skip to content

Commit

Permalink
fix(jexl): add flatten to form builder jexl validation
Browse files Browse the repository at this point in the history
  • Loading branch information
anehx committed Jul 21, 2023
1 parent c8a7ce7 commit 9bc2412
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/form-builder/addon/validators/jexl.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const TRANSFORMS = [
"sum",
"avg",
"stringify",
"flatten",
];
const BINARY_OPS = ["intersects"];

Expand Down
3 changes: 3 additions & 0 deletions packages/form/addon/lib/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ export default class Document extends Base {
get jexl() {
const documentJexl = new jexl.Jexl();

// WARNING: When adding a new transform or operator, make sure to add it in
// `packages/form-builder/addon/validators/jexl.js` as well for the
// validation in the form builder.
documentJexl.addTransform("answer", (slug, defaultValue) =>
this.findAnswer(slug, defaultValue),
);
Expand Down

0 comments on commit 9bc2412

Please sign in to comment.