Skip to content
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

aws-pipes-alpha: InputTransformation in Pipe should automatically add expression delimiters #32416

Open
1 task
garysassano opened this issue Dec 8, 2024 · 1 comment
Labels
@aws-cdk/aws-pipes Related to aws-pipes-* bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@garysassano
Copy link

Describe the bug

When using the AWS Pipes L2 construct, there's an inconsistency in how JSON paths are handled between queryStringParameters and inputTransformation.

For queryStringParameters, JSON paths work directly:

queryStringParameters: {
  key: "$.dynamodb.Keys.Location.S",
  ttl_seconds: "$.dynamodb.NewImage.TTL.N"
}

However, for inputTransformation, we need to manually add expression delimiters (<>) around JSON paths:

inputTransformation: InputTransformation.fromObject({
  Location: "<$.dynamodb.Keys.Location.S>",
  MaxTemp: "<$.dynamodb.NewImage.MaxTemp.N>",
  MinTemp: "<$.dynamodb.NewImage.MinTemp.N>",
  ChancesOfPrecipitation: "<$.dynamodb.NewImage.ChancesOfPrecipitation.N>"
})

This creates an inconsistent developer experience and increases the chance of errors if developers forget to add the delimiters.

Suggested Solution

The L2 construct should automatically add the required expression delimiters (<>) around JSON paths in inputTransformation objects, similar to how queryStringParameters handles paths directly.

Example of desired API:

inputTransformation: InputTransformation.fromObject({
  Location: "$.dynamodb.Keys.Location.S",
  MaxTemp: "$.dynamodb.NewImage.MaxTemp.N",
  MinTemp: "$.dynamodb.NewImage.MinTemp.N",
  ChancesOfPrecipitation: "$.dynamodb.NewImage.ChancesOfPrecipitation.N"
})

The L2 construct could detect JSON paths (starting with $.) and automatically wrap them in expression delimiters, improving developer experience and preventing errors from forgotten delimiters.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

See above.

Current Behavior

See above.

Reproduction Steps

See above.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.172.0

Framework Version

No response

Node.js Version

22.11.0

OS

Ubuntu 24.04

Language

TypeScript

Language Version

No response

Other information

No response

@garysassano garysassano added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 8, 2024
@github-actions github-actions bot added the @aws-cdk/aws-dynamodb Related to Amazon DynamoDB label Dec 8, 2024
@pahud
Copy link
Contributor

pahud commented Dec 9, 2024

Yes this seems to be inconsistent developer experience. Not sure if this is intentional. We'll bring this up to the team for inputs.

@pahud pahud added p2 effort/medium Medium work item – several days of effort @aws-cdk/aws-pipes Related to aws-pipes-* and removed needs-triage This issue or PR still needs to be triaged. @aws-cdk/aws-dynamodb Related to Amazon DynamoDB labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-pipes Related to aws-pipes-* bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

No branches or pull requests

2 participants