Skip to content

feat(stepfunctions): add support for Jsonata expressions to Map.ItemSelector #34625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 6, 2025

Conversation

leonmk-aws
Copy link
Contributor

@leonmk-aws leonmk-aws commented Jun 4, 2025

Issue

Closes #34538.

Reason for this change

In the current implementation itemSelector must be an object type Mapping[str, Any], but Step Functions supports both object mappings and JSONata expressions as strings.

See the Amazon States Language specification:

A JSONata Map State MAY have an "ItemSelector" field, whose value MUST be a JSON text, or a JSONata string that evaluates to a JSON text.

Description of changes

This PR adds a new field jsonataItemSelector of type string to support this use case. This new field is mutually exclusive with itemSelector (and parameters as it is already mutually exclusive with itemSelector and deprecated).

During synthesis, if jsonataItemSelector is used, then it will be used to render the ItemSelector in the cloudformation template.

I considered creating a class like the ProvideItems class, however this would have been a breaking change for existing users.

Describe any new or updated permissions being added

None.

Description of how you validated changes

Added unit tests and an integration test.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team June 4, 2025 10:08
@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p1 labels Jun 4, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 4, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@leonmk-aws leonmk-aws changed the title feat(stepfunctions): Add support for Jsonata expressions to Map.ItemSelector feat(stepfunctions): add support for Jsonata expressions to Map.ItemSelector Jun 4, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review June 4, 2025 13:15

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@leonmk-aws leonmk-aws marked this pull request as ready for review June 4, 2025 16:07
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jun 4, 2025
@alvazjor alvazjor self-assigned this Jun 5, 2025
@@ -120,7 +120,7 @@ export class Map extends MapBase implements INextable {
errors.push('Map state cannot have both an iterator and an item processor');
}

if (this.parameters && this.itemSelector) {
if (this.parameters && (this.itemSelector || this.jsonataItemSelector)) {
Copy link
Contributor

@alvazjor alvazjor Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here we should also validate that the jsonataItemSelector string has the correct syntax format: {% <string> %}

Copy link
Contributor

@alvazjor alvazjor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

mergify bot commented Jun 6, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: d58729d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

mergify bot commented Jun 6, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit dc30faa into aws:main Jun 6, 2025
16 checks passed
Copy link
Contributor

github-actions bot commented Jun 6, 2025

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort p1 pr/needs-maintainer-review This PR needs a review from a Core Team Member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stepfunctions: Map.ItemSelector doesn't accept JSONata
3 participants