fix(stepfunctions): various JSONata query language fix#33404
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33404 +/- ##
=======================================
Coverage 82.16% 82.16%
=======================================
Files 119 119
Lines 6857 6857
Branches 1157 1157
=======================================
Hits 5634 5634
Misses 1120 1120
Partials 103 103
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Marking this PR as Also update the PR label to correctly reflect the issue priority. |
…#33423) ### Issue # (if applicable) Closes #33403 and #33374 and #33396. ### Reason for this change There are three issues here: 1. For summary, the first issue is basically that assign property cannot be accessed with using Map.jsonata(...) but available if we directly create map through new Map(...) using JSONATA query language. 2. For summary, the second issue is that JSONATA main PR added the outputs and assign property in the CatchProps interface for AddCatch functionality. But I don't think it's being used in the actual `addCatch` call https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-stepfunctions/lib/states/state.ts#L398. 3. Result writer and item reader class do not support using JSONATA. Deployment will fails due to if SFN is set to use JSONATA, it expects `Arguments` in the ASL instead of `Parameters`. ### Description of changes Fix both issues by fixing the interface inheritance and added the props to `AddCatch` method. Support `JSONATA` as the query language. ### Description of how you validated changes Added integ test and unit test to make sure that ### Checklist - [ ] 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*
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
WinterYukky
left a comment
There was a problem hiding this comment.
Hi, thank you so much for fixing this bug. I'm very honored that you started working on this fix right away.
assign and _addCatch fix seems good! On the other hand, itemReader and itemWriter may need to be changes. In itemReader and itemWriter, whether to use Arguments or Parameters is determined only by the top-level or Map state queryLanguage. In this PR, users can use s3objectsitemReader.jsonata() and s3objectsitemReader.jsonPath(), but for example, s3objectsitemReader.jsonPath() (i.e. Parameters) can be used when the Map state uses JSONata we can't.
// invalid cofigure
const distributedMap = sfn.DistributedMap.jsonPath(this, 'DistributedMap', {
itemReader: sfn.S3ObjectsItemReader.jsonata({
bucketNamePath: '{% $bucketName %}',
prefix: '{% $prefix %}',
}),
});This should probably be processed projectively with CDK without relying on user specifications. Also, since the properties used in JSONata and JSONPath are not different, there is probably no need to use different constructors.
const distributedMap = sfn.DistributedMap.jsonPath(this, 'DistributedMap', {
itemReader: new sfn.S3ObjectsItemReader({
bucketName: '{% $bucketName %}',
prefix: '{% $prefix %}',
}),
});
packages/aws-cdk-lib/aws-stepfunctions/lib/states/distributed-map/item-reader.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-stepfunctions/lib/states/distributed-map/item-reader.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-stepfunctions/lib/states/distributed-map/item-reader.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk-lib/aws-stepfunctions/lib/states/distributed-map/item-reader.ts
Outdated
Show resolved
Hide resolved
|
@WinterYukky I addressed all your comments. Please give it another review once you're available. |
|
@mergify update |
✅ Branch has been successfully updated |
Dismiss to get this merged and released.
|
@Mergifyio requeue |
❌ This pull request head commit has not been previously disembarked from queue. |
|
@mergify update |
✅ Branch has been successfully updated |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #33403 and #33374 and #33396.
Reason for this change
There are three issues here:
addCatchcall https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-stepfunctions/lib/states/state.ts#L398.Argumentsin the ASL instead ofParameters.Description of changes
Fix both issues by fixing the interface inheritance and added the props to
AddCatchmethod.Support
JSONATAas the query language.Description of how you validated changes
Added integ test and unit test to make sure that
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license