Commit 8805e13
authored
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- packages
- @aws-cdk-testing/framework-integ/test/aws-stepfunctions/test
- integ.state-machine-jsonata.js.snapshot
- asset.ca235e6258b11c240506ff06f79037eca461b8d0d9464a947a386d38d8163515.bundle
- aws-cdk-lib
- aws-stepfunctions-tasks/lib
- http
- private
- aws-stepfunctions
- lib
- private
- test/private
15 files changed
+3075
-1412
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments