Skip to content

Commit

Permalink
fix(kernel): correctly serialize enum values (#754)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
RomainMuller authored Aug 29, 2019
1 parent cf5b325 commit 41ed25d
Show file tree
Hide file tree
Showing 16 changed files with 1,133 additions and 858 deletions.
20 changes: 17 additions & 3 deletions packages/jsii-calc/lib/compliance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,23 @@ export enum AllTypesEnum {
}

export enum StringEnum {
A = 'A',
B = 'B',
C = 'C'
A = 'A!',
B = 'B?',
C = 'C.'
}

export class EnumDispenser {
public static randomStringLikeEnum(): StringEnum {
// Haha! I lied, it's not random!! *EVIL LAUGHTER*
return StringEnum.B;
}

public static randomIntegerLikeEnum(): AllTypesEnum {
// Haha! I lied, it's not random!! *EVIL LAUGHTER*
return AllTypesEnum.YOUR_ENUM_VALUE;
}

private constructor() { }
}

/**
Expand Down
Loading

0 comments on commit 41ed25d

Please sign in to comment.