Skip to content

Commit 3752bc0

Browse files
authored
chore: fix CloudFormation spec generation (#18441)
Two issues with the latest (v52.0.0) CloudFormation spec generation. First, we are still combining "V2" libraries into single modules. This means new generation services (like Inspector V2) are bundled into the existing (e.g., `@aws-cdk/aws-inspector`) modules. Second, there was an issue with the Lightsail spec due to one of the properties being "GetObject", which is not jsii-compliant. Introducing a hack here to add an underscore in front of the Typescript property name (but not the generated CloudFormation). Very open to better ideas, but this does work. Once this has been pushed, we can regenerate the spec (now on version v53.0.0) as usual. related #18305 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 626e6aa commit 3752bc0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

tools/@aws-cdk/cfn2ts/lib/genspec.ts

+7
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,13 @@ export function cloudFormationToScriptName(name: string): string {
237237
}
238238
}
239239

240+
// There is (so far) one example of a property which has a "getter"-looking name
241+
// (GetObject). This is not `jsii`-compliant, as it would conflict with generated getter method names.
242+
// As an ugly hack, we prepend the Typescript name with an underscore.
243+
if (/^Get[A-Z]/.test(name)) {
244+
return `_${ret}`;
245+
}
246+
240247
return ret;
241248
}
242249

tools/@aws-cdk/pkglint/lib/library-creation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface ModuleDefinition {
1919

2020
export function createModuleDefinitionFromCfnNamespace(namespace: string): ModuleDefinition {
2121
const [moduleFamily, moduleBaseName] = (namespace === 'AWS::Serverless' ? 'AWS::SAM' : namespace).split('::');
22-
const moduleName = `${moduleFamily}-${moduleBaseName.replace(/V\d+$/, '')}`.toLocaleLowerCase();
22+
const moduleName = `${moduleFamily}-${moduleBaseName}`.toLocaleLowerCase();
2323

2424
const lowcaseModuleName = moduleBaseName.toLocaleLowerCase();
2525
const packageName = `@aws-cdk/${moduleName}`;

0 commit comments

Comments
 (0)