Skip to content

feat(spec2cdk): support for auto-generated grants in alpha modules#36206

Merged
mergify[bot] merged 7 commits intomainfrom
otaviom/alpha-grants
Jan 13, 2026
Merged

feat(spec2cdk): support for auto-generated grants in alpha modules#36206
mergify[bot] merged 7 commits intomainfrom
otaviom/alpha-grants

Conversation

@otaviomacedo
Copy link
Copy Markdown
Contributor

@otaviomacedo otaviomacedo commented Nov 26, 2025

Grants classes are only generated in the aws-cdk-lib module (if a grants.json file is present). However, for alpha modules, we want the auto-generated files to be treated as alpha.

This PR adds support for generating Grants classes in alpha modules, if a grants.json file is present.

Also added a new grants.json in aws-elasticache-alpha to demonstrate that the change works.

Main changes:

  • generateAll() now takes an additional output directory: the root of the alpha modules.
  • A new GrantsProps struct is being passed around, that contains the config itself plus a flag indicating whether the module is stable.
  • The location where the module should be written now depends on whether the module is stable.
  • In the grants module, the import for the corresponding stable module is either
    • import * as <service> from "./<service>.generated";, for stable modules, or
    • import * as <service> from "aws-cdk-lib/aws-<service>";, for unstable modules.

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

@aws-cdk-automation aws-cdk-automation requested a review from a team November 26, 2025 09:49
@github-actions github-actions bot added the p2 label Nov 26, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 26, 2025
Copy link
Copy Markdown
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)

@otaviomacedo otaviomacedo added pr-linter/exempt-readme The PR linter will not require README changes pr-linter/exempt-integ-test The PR linter will not require integ test changes labels Nov 26, 2025
@aws-cdk-automation aws-cdk-automation dismissed stale reviews from themself November 26, 2025 10:02

✅ 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 26, 2025
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Nov 26, 2025
public write(module: Module, filePath: string): string {
log.debug(module.name, filePath, 'render');
const fullPath = path.join(this.rootDir, filePath);
public write(module: Module, fullPath: string): string {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior here has changed: the second parameter is an absolute path, instead of relative to some root directory passed to the constructor.

# Conflicts:
#	packages/@aws-cdk/aws-elasticache-alpha/lib/serverless-cache-base.ts
#	tools/@aws-cdk/spec2cdk/lib/cdk/aws-cdk-lib.ts
#	tools/@aws-cdk/spec2cdk/lib/cdk/grants-module.ts
#	tools/@aws-cdk/spec2cdk/lib/cdk/library-builder.ts
#	tools/@aws-cdk/spec2cdk/test/grants.test.ts
@otaviomacedo otaviomacedo added the pr/do-not-merge This PR should not be merged at this time. label Dec 16, 2025
@otaviomacedo otaviomacedo marked this pull request as draft December 16, 2025 10:10
@github-actions
Copy link
Copy Markdown
Contributor

TestsPassed ❌️SkippedFailed
Security Guardian Results
TestResult
No test annotations available

@github-actions
Copy link
Copy Markdown
Contributor

TestsPassed ❌️SkippedFailed
Security Guardian Results with resolved templates
TestResult
No test annotations available

@otaviomacedo otaviomacedo marked this pull request as ready for review January 8, 2026 10:33
@otaviomacedo otaviomacedo requested a review from rix0rrr January 8, 2026 10:33
@otaviomacedo otaviomacedo removed the pr/do-not-merge This PR should not be merged at this time. label Jan 13, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 13, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 13, 2026

Merge Queue Status

✅ The pull request has been merged at 10789e9

This pull request spent 38 minutes 24 seconds in the queue, including 29 minutes 18 seconds running CI.
The checks were run in-place.

Required conditions to merge

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 13, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 776f837 into main Jan 13, 2026
17 of 18 checks passed
@mergify mergify bot deleted the otaviom/alpha-grants branch January 13, 2026 10:13
@github-actions
Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-readme The PR linter will not require README changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants