Skip to content

Conversation

@rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Nov 5, 2025

The spec2cdk tool was originally written to generate every service submodule insularly.

We want to now extend it to emit structures into a new shared submodule. In order to do that, this refactors the generator to have a more shared, mutable object-oriented design which will be easier to share state in.

The core of the change looks like this:

// Old
for (const service of services) {
  const module = AstBuilder.forService(service);

  const writer = new TsFileWriter();
  writer.write(module);
}

// New
const ast = new AstBuilder();
for (const service of service) {
  ast.addService(service);
}

const writer = new TsFileWriter();
ast.writeAll(writer);
  • Make the API based more around mutable objects with shared state.
  • Remove the specific ServiceModule, ResourceModule classes, because they were adding no benefit over the generic Module.
  • Simplify the API around file name patterns, because they were being overly flexible and annoying to work with for no real benefit.

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

@rix0rrr rix0rrr requested a review from a team November 5, 2025 08:08
@aws-cdk-automation aws-cdk-automation requested a review from a team November 5, 2025 08:08
@github-actions github-actions bot added the p2 label Nov 5, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 5, 2025
The `spec2cdk` tool was originally written to generate every service
submodule insularly.

We want to now extend it to emit structures into a new shared submodule.
In order to do that, this refactors the generator to have a more shared,
mutable object-oriented design which will be easier to share state in.

In addition, simplify the API around file name patterns, because they
were being overly flexible and annoying to work with for no real
benefit.
@rix0rrr rix0rrr marked this pull request as ready for review November 5, 2025 09:12
@mergify
Copy link
Contributor

mergify bot commented Nov 6, 2025

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
Contributor

mergify bot commented Nov 6, 2025

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 53eac94 into main Nov 6, 2025
18 of 19 checks passed
@mergify mergify bot deleted the huijbers/spec2cdk branch November 6, 2025 10:10
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

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 Nov 6, 2025
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants