Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: same values but different casing creates conflicting enums #1259

Merged
merged 2 commits into from
Nov 22, 2023

Conversation

vinayak-kukreja
Copy link
Contributor

@vinayak-kukreja vinayak-kukreja commented Nov 20, 2023

Enums in schema which has same value but different casing creates same enum values which conflicts with each other. For instance, observed while importing a custom resource definition in cdk8s.

\| 1086   REPLACE = 'replace',
--
\|        ~~~~~~~
\| com.coreos.monitoring.ts:1088:3 - error TS2300: Duplicate identifier 'REPLACE'.
\| 1088   REPLACE = 'Replace',
\|        ~~~~~~~
\| com.coreos.monitoring.ts:1090:3 - error TS2300: Duplicate identifier 'KEEP'.
\| 1090   KEEP = 'keep',
\|        ~~~~
\| com.coreos.monitoring.ts:1092:3 - error TS2300: Duplicate identifier 'KEEP'.
\| 1092   KEEP = 'Keep',
\|        ~~~~
\| com.coreos.monitoring.ts:1094:3 - error TS2300: Duplicate identifier 'DROP'.
\| 1094   DROP = 'drop',
\|        ~~~~
\| com.coreos.monitoring.ts:1096:3 - error TS2300: Duplicate identifier 'DROP'.
\| 1096   DROP = 'Drop',

Fixes cdk8s-team/cdk8s-cli#578

Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
src/type-generator.ts Outdated Show resolved Hide resolved
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
@cdklabs-automation cdklabs-automation added this pull request to the merge queue Nov 22, 2023
Merged via the queue into main with commit c5e809c Nov 22, 2023
7 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Sep 12, 2024
)

Required for cdk8s-team/cdk8s-cli#2722

Even though we arbitrarily choose which property to emit, this is not a
breaking change because these scenarios right now produce invalid
typescript code.

> This is similar to and a continuation of
#1259

---

### Ask Yourself

- [x] Have you reviewed the [contribution
guide](https://github.com/cdklabs/json2jsii/blob/main/CONTRIBUTING.md)?
- [x] Have you reviewed the [breaking changes
guide](https://github.com/cdklabs/json2jsii/blob/main/CONTRIBUTING.md#breaking-changes)?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importing prometheus-operator CRD causes compile to fail
3 participants