Skip to content

Commit

Permalink
chore(cfn2ts): annotate generated CFN classes as '@stable' (#2771)
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainMuller authored and Elad Ben-Israel committed Jun 24, 2019
1 parent 181f369 commit 97b1168
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions tools/cfn2ts/lib/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ export default class CodeGenerator {
if (!spec.Properties || Object.keys(spec.Properties).length === 0) { return; }
const name = genspec.CodeName.forResourceProperties(resourceContext);

this.docLink(spec.Documentation, `Properties for defining a \`${resourceContext.specName!.fqn}\``);
this.docLink(spec.Documentation,
`Properties for defining a \`${resourceContext.specName!.fqn}\``,
'',
'@stable');
this.code.openBlock(`export interface ${name.className}`);

const conversionTable = this.emitPropsTypeProperties(resourceContext, spec.Properties, Container.Interface);
Expand Down Expand Up @@ -175,7 +178,7 @@ export default class CodeGenerator {
}
}

private emitResourceType(resourceName: genspec.CodeName, spec: schema.ResourceType, deprecated?: genspec.CodeName): void {
private emitResourceType(resourceName: genspec.CodeName, spec: schema.ResourceType): void {
this.beginNamespace(resourceName);

const cfnName = resourceName.specName!.fqn;
Expand All @@ -189,16 +192,11 @@ export default class CodeGenerator {
this.code.line();
}

const deprecation = deprecated &&
`"cloudformation.${resourceName.fqn}" will be deprecated in a future release ` +
`in favor of "${deprecated.fqn}" (see https://github.com/awslabs/aws-cdk/issues/878)`;

this.docLink(spec.Documentation, ...[
this.docLink(spec.Documentation,
`A CloudFormation \`${cfnName}\``,
'',
`@cloudformationResource ${cfnName}`,
...(deprecation ? [ `@deprecated ${deprecation}` ] : [ ]),
]);
'@stable');
this.openClass(resourceName, RESOURCE_BASE_CLASS);

//
Expand Down Expand Up @@ -294,10 +292,6 @@ export default class CodeGenerator {
}
}

if (deprecated) {
this.code.line(`this.node.addWarning('DEPRECATION: ${deprecation}');`);
}

// initialize all property class members
if (propsType && propMap) {
this.code.line();
Expand Down Expand Up @@ -574,7 +568,7 @@ export default class CodeGenerator {
this.code.line();
this.beginNamespace(typeName);

this.docLink(propTypeSpec.Documentation);
this.docLink(propTypeSpec.Documentation, '@stable');
if (!propTypeSpec.Properties || Object.keys(propTypeSpec.Properties).length === 0) {
this.code.line(`// tslint:disable-next-line:no-empty-interface | A genuine empty-object type`);
}
Expand Down

0 comments on commit 97b1168

Please sign in to comment.