From eb7acb478316fbd45d94da4168e807bddc6d1262 Mon Sep 17 00:00:00 2001 From: Kaizen Conroy Date: Tue, 28 Nov 2023 17:58:39 -0500 Subject: [PATCH 1/2] fix(spec2cdk): attributes in ICfnResource should not be optional --- tools/@aws-cdk/spec2cdk/lib/cdk/resource-decider.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/@aws-cdk/spec2cdk/lib/cdk/resource-decider.ts b/tools/@aws-cdk/spec2cdk/lib/cdk/resource-decider.ts index b4548d732902b..913f8459856b0 100644 --- a/tools/@aws-cdk/spec2cdk/lib/cdk/resource-decider.ts +++ b/tools/@aws-cdk/spec2cdk/lib/cdk/resource-decider.ts @@ -77,6 +77,7 @@ export class ResourceDecider { remarks: (propSpec.docs?.remarks ?? '').concat('@cloudformationAttribute Ref'), }, immutable: true, + optional: false, }; } From 2295c7fc6491e2eb17129ab2e5a2a63350894fd9 Mon Sep 17 00:00:00 2001 From: Kaizen Conroy Date: Tue, 28 Nov 2023 17:59:16 -0500 Subject: [PATCH 2/2] tests --- .../test/__snapshots__/resources.test.ts.snap | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/@aws-cdk/spec2cdk/test/__snapshots__/resources.test.ts.snap b/tools/@aws-cdk/spec2cdk/test/__snapshots__/resources.test.ts.snap index 2129619e82fd9..656dc73d1e741 100644 --- a/tools/@aws-cdk/spec2cdk/test/__snapshots__/resources.test.ts.snap +++ b/tools/@aws-cdk/spec2cdk/test/__snapshots__/resources.test.ts.snap @@ -18,7 +18,7 @@ export interface ICfnResource extends constructs.IConstruct { * * @cloudformationAttribute Ref */ - readonly attrId?: string; + readonly attrId: string; } /** @@ -62,7 +62,7 @@ export class CfnResource extends cdk.CfnResource implements cdk.IInspectable, IC * * @cloudformationAttribute Ref */ - public readonly attrId?: string; + public readonly attrId: string; /** * The identifier of the resource. @@ -1107,14 +1107,14 @@ import * as cfn_parse from "aws-cdk-lib/core/lib/helpers-internal"; * * @stability external */ -export interface ICfnResource { +export interface ICfnResource extends constructs.IConstruct { /** * The identifier of the resource. * This property gets determined after the resource is created. * * @cloudformationAttribute Ref */ - readonly attrId?: string; + readonly attrId: string; /** * Another identifier of the resource. @@ -1122,7 +1122,7 @@ export interface ICfnResource { * * @cloudformationAttribute Ref */ - readonly attrAnotherId?: string; + readonly attrAnotherId: string; } /** @@ -1166,7 +1166,7 @@ export class CfnResource extends cdk.CfnResource implements cdk.IInspectable, IC * * @cloudformationAttribute Ref */ - public readonly attrAnotherId?: string; + public readonly attrAnotherId: string; /** * The identifier of the resource. @@ -1174,7 +1174,7 @@ export class CfnResource extends cdk.CfnResource implements cdk.IInspectable, IC * * @cloudformationAttribute Ref */ - public readonly attrId?: string; + public readonly attrId: string; /** * Another identifier of the resource. @@ -1305,14 +1305,14 @@ import * as cfn_parse from "aws-cdk-lib/core/lib/helpers-internal"; * * @stability external */ -export interface ICfnResource { +export interface ICfnResource extends constructs.IConstruct { /** * The identifier of the resource. * This property gets determined after the resource is created. * * @cloudformationAttribute Ref */ - readonly attrId?: string; + readonly attrId: string; } /** @@ -1356,7 +1356,7 @@ export class CfnResource extends cdk.CfnResource implements cdk.IInspectable, IC * * @cloudformationAttribute Ref */ - public readonly attrId?: string; + public readonly attrId: string; /** * The identifier of the resource.