Skip to content

Conversation

@leonmk-aws
Copy link
Contributor

Issue # (if applicable)

Closes #.

Reason for this change

In some languages for which jsii cannot properly generate unions like Go, if a user passes the wrong property (i.e an ILayerRef instead of an IRoleRef), the error message will be unclear:

panic: ValidationError: Resolution error: Resolution error: Trying to resolve() a Construct at /Resources/${Token[GoAppStack.SampleFunction.LogicalID.139]}/Properties/role/node..

Description of changes

Add a check to ensure that all unions have been resolved to a string and throw an error if not, at runtime it will look like:

panic: TypeError: Property role should be one of iam.IRoleRef | string

Description of how you validated changes

Ran locally, updated snapshot tests. Unit test will be added once the relationships are enabled for lambda.

Checklist


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

@leonmk-aws leonmk-aws requested a review from a team as a code owner October 31, 2025 16:56
@aws-cdk-automation aws-cdk-automation requested a review from a team October 31, 2025 16:56
@github-actions github-actions bot added the p2 label Oct 31, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Oct 31, 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 core(spec2cdk): ensure strings are passed to attributes chore(spec2cdk): ensure strings are passed to attributes Nov 3, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review November 3, 2025 09:12

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

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution/core This is a PR that came from AWS. p2 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.

2 participants