Skip to content

Commit 8805e13

Browse files
fix(stepfunctions): allow multiline jsonata strings (#35985)
### Issue #35912 Closes #35912. ### Reason for this change The inability to use multiline JSONata expressions in certain places, for example: ``` Condition.jsonata(`{% false %}`) ``` ### Description of changes - Add the "dotAll" flag to the private jsonata helper testing whether a string is wrapped in the Step Functions JSONata expression tags. The "s" flag allows the dot to match across newlines, enabling the use of well-formatted complex expressions. - Also considered `String.startsWith` and `String.endsWith`, but opted for the minimal change to preserve the existing regex which is also likely more performant. - Include unit tests for both helper functions in `jsonata.ts`. - Reuse `isValidJsonataExpression` where the same regex expression was used in `condition.ts` and `task-utils.ts`. ### Describe any new or updated permissions being added N/A ### Description of how you validated changes - Unit tests were added including the multiline cases. - Existing integration test for Step Functions with JSONata was updated to have its Condition use a multi-line string. - A construct overriding Condition to use this regex for validation was successfully used in a local project to get around the current single-line limitation. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 95be51c commit 8805e13

File tree

15 files changed

+3075
-1412
lines changed

15 files changed

+3075
-1412
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-jsonata.js.snapshot/StateMachineJsonataDefaultTestDeployAssertF616C932.assets.json

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-jsonata.js.snapshot/StateMachineJsonataDefaultTestDeployAssertF616C932.template.json

Lines changed: 8 additions & 156 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)