aws / aws/jsii

Rosetta: incorrect transliteration of array of structs

Open
#3,908 1 comment 0 reactions 0 assignees View on GitHub
bug p2
Dominant language
TypeScript
Stars
2.9k
Forks
267
Avg merge
1d 25m
Merged PRs (30d)
14

Description

### Describe the bug

See the `cdk-nag` documentation at https://constructs.dev/packages/cdk-nag/v/2.21.56?lang=python, the 4th example suppression rule (Stack Level) includes the following incorrect python code:

```py
NagSuppressions.add_stack_suppressions(stack, [id="AwsSolutions-EC23", reason="lorem ipsum"
])
```

This is supposed to be a transliteration of the following:

```ts
NagSuppressions.addStackSuppressions(stack, [
{ id: 'AwsSolutions-EC23', reason: 'lorem ipsum' },
]);
```

### Expected Behavior

The transliterated code should look more like so:

```py
NagSuppressions.add_stack_suppressions(stack, [
{ "id": "AwsSolutions-EC23", "reason": "lorem ipsum" }
])
```

### Current Behavior

See above...

### Reproduction Steps

Trivial.

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### SDK version used

N/A

### Environment details (OS name and version, etc.)

N/A

Contributor guide

Open the contributing guide

Research direction

Start with the Rosetta transliteration behavior shown in the cdk-nag documentation example and compare it with the TypeScript source array of structs. Trace how Rosetta renders the array and its object fields, then verify that the generated Python example preserves the id and reason fields in the documented form.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.