Skip to content

Commit 41ed25d

Browse files
authored
fix(kernel): correctly serialize enum values (#754)
When string-valued enums were serialized, an incorrect reference would be created if the label of the enum entry did not match it's string value; due to the lookup code being incorrect. Updated a string-valued enum and introduced new compliance tests to ensure such enum values are passed across correctly. Fixes #753
1 parent cf5b325 commit 41ed25d

File tree

16 files changed

+1133
-858
lines changed

16 files changed

+1133
-858
lines changed

packages/jsii-calc/lib/compliance.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,23 @@ export enum AllTypesEnum {
2727
}
2828

2929
export enum StringEnum {
30-
A = 'A',
31-
B = 'B',
32-
C = 'C'
30+
A = 'A!',
31+
B = 'B?',
32+
C = 'C.'
33+
}
34+
35+
export class EnumDispenser {
36+
public static randomStringLikeEnum(): StringEnum {
37+
// Haha! I lied, it's not random!! *EVIL LAUGHTER*
38+
return StringEnum.B;
39+
}
40+
41+
public static randomIntegerLikeEnum(): AllTypesEnum {
42+
// Haha! I lied, it's not random!! *EVIL LAUGHTER*
43+
return AllTypesEnum.YOUR_ENUM_VALUE;
44+
}
45+
46+
private constructor() { }
3347
}
3448

3549
/**

0 commit comments

Comments
 (0)