(stepfunctions-tasks): DynamoDB attribute map synth output
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
### Describe the bug
sfntask.DynamoAttributeValue.mapFromJsonPath --> $.$.M
>
const addNewDocVersion2 = new sfntask.DynamoPutItem(this, 'addNewDocVersion2', {
table: props.formtable,
item: {
Id: sfntask.DynamoAttributeValue.fromString(sfn.JsonPath.stringAt('$.Item.Id.S')),
sk: sfntask.DynamoAttributeValue.fromString(sfn.JsonPath.format('v{}',sfn.JsonPath.stringAt('$.latest_version.latest_version.N'))),
BusinessRule: sfntask.DynamoAttributeValue.mapFromJsonPath(sfn.JsonPath.stringAt('$.Item.BusinessRule.M')),
Status: sfntask.DynamoAttributeValue.fromString('BusinessRuleProcessed'),
Updated: sfntask.DynamoAttributeValue.fromNumber(businessRuleTS),
Table: sfntask.DynamoAttributeValue.listFromJsonPath(sfn.JsonPath.stringAt('$.Item.Table.L')),
KeyValue: sfntask.DynamoAttributeValue.mapFromJsonPath(sfn.JsonPath.stringAt('$.Item.KeyValue.M')),
},
resultPath: JsonPath.DISCARD
})
It turns into:
>
"Parameters": {
"Item": {
"Id": {
"S.$": "$.Item.Id.S"
},
"sk": {
"S.$": "States.Format('v{}', $.latest_version.latest_version.N)"
},
"BusinessRule": {
"M.$.$": "$.Item.BusinessRule.M"
},
"Status": {
"S": "BusinessRuleProcessed"
},
"Updated": {
"N": "1657831854044"
},
"Table": {
"L.$": "$.Item.Table.L"
},
"KeyValue": {
"M.$.$": "$.Item.KeyValue.M"
}
},
### Expected Behavior
sfntask.DynamoAttributeValue.mapFromJsonPath Should be $.M
### Current Behavior
sfntask.DynamoAttributeValue.mapFromJsonPath should not be $.$.M
### Reproduction Steps
const addNewDocVersion2 = new sfntask.DynamoPutItem(this, 'addNewDocVersion2', {
table: props.formtable,
item: {
Id: sfntask.DynamoAttributeValue.fromString(sfn.JsonPath.stringAt('$.Item.Id.S')),
sk: sfntask.DynamoAttributeValue.fromString(sfn.JsonPath.format('v{}',sfn.JsonPath.stringAt('$.latest_version.latest_version.N'))),
BusinessRule: sfntask.DynamoAttributeValue.mapFromJsonPath(sfn.JsonPath.stringAt('$.Item.BusinessRule.M')),
Status: sfntask.DynamoAttributeValue.fromString('BusinessRuleProcessed'),
Updated: sfntask.DynamoAttributeValue.fromNumber(businessRuleTS),
Table: sfntask.DynamoAttributeValue.listFromJsonPath(sfn.JsonPath.stringAt('$.Item.Table.L')),
KeyValue: sfntask.DynamoAttributeValue.mapFromJsonPath(sfn.JsonPath.stringAt('$.Item.KeyValue.M')),
},
resultPath: JsonPath.DISCARD
})
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.31.2
### Framework Version
_No response_
### Node.js Version
v14.17.6
### OS
Mac OS
### Language
Typescript
### Language Version
TypeScript 4.7.4
### Other information
_No response_
Contributor guide
Research direction
Start at DynamoAttributeValue.mapFromJsonPath and reproduce the issue with the shown DynamoPutItem configuration. Compare the synthesized Step Functions Parameters output for BusinessRule and KeyValue; done means mapFromJsonPath emits M.$ with the JSONPath rather than M.$.$.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100