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

chore: duplicate enum values not usable #17731

Merged
merged 1 commit into from
Nov 26, 2021
Merged

Conversation

njlynch
Copy link
Contributor

@njlynch njlynch commented Nov 26, 2021

There is an outstanding bug with jsii
(aws/jsii#2782) where duplicate enum values are not
available to the non-JS/TS languages. In these cases, only the first enum value
defined is present in the assembly.

For these cases, the first value was the deprecated one. This meant that only
the deprecated values were present, and once we stripped the deprecated
elements, we were left without values. For v2 only, we can reorder these enums
so the non-deprecated values appear in the assembly. Note that we cannot
backport this to master (v1), because it would introduce breaking changes to
our Java/Go/Dotnet/Python customers.

Methodology:
I modified list-deprecated-apis.js to only output deprecated enum members
and deprecation reasons, and ran it against 2.0.0-rc.31, which is the latest CDK v2
release candidate that didn't actually strip the deprecated elements. There were only
42 results, which combined with the deprecation messages made it reasonable to
manually verify all of the results.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@njlynch njlynch requested a review from a team November 26, 2021 11:20
@njlynch njlynch self-assigned this Nov 26, 2021
@gitpod-io
Copy link

gitpod-io bot commented Nov 26, 2021

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 26, 2021
There is an outstanding bug with `jsii`
(aws/jsii#2782) where duplicate enum values are not
available to the non-JS/TS languages. In these cases, only the first enum value
defined is present in the assembly.

For these cases, the first value was the deprecated one. This meant that only
the deprecated values were present, and once we stripped the deprecated
elements, we were left without values. For *v2 only*, we can reorder these enums
so the non-deprecated values appear in the assembly. Note that we *cannot*
backport this to `master` (v1), because it would introduce breaking changes to
our Java/Go/Dotnet/Python customers.
Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wild

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 0a94ad5
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@njlynch njlynch merged commit f5f8f92 into v2-main Nov 26, 2021
@njlynch njlynch deleted the njlynch/fix-enum-order branch November 26, 2021 12:05
@mergify
Copy link
Contributor

mergify bot commented Nov 26, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

njlynch added a commit that referenced this pull request Nov 26, 2021
* chore: fix build break caused by exported deprecated functions (#17719)

Functions (not member methods) aren't acknowledged by jsii, so they are not
stripped out of the compiled source, even when deprecated. These two functions
are deprecated and reference deprecated interfaces. When running the init
template tests against JS/TS, the tests fail with:

```
node_modules/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.d.ts(110,62): error TS2304: Cannot find name 'FixedResponse'.
node_modules/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.d.ts(116,68): error TS2304: Cannot find name 'RedirectResponse'.
```

By -- on v2 only -- un-exporting the functions and inlining them in their
secondary usages, we can effectively "strip" these functions from the JS/TS.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*

* chore: duplicate enum values not usable (#17731)

There is an outstanding bug with `jsii`
(aws/jsii#2782) where duplicate enum values are not
available to the non-JS/TS languages. In these cases, only the first enum value
defined is present in the assembly.

For these cases, the first value was the deprecated one. This meant that only
the deprecated values were present, and once we stripped the deprecated
elements, we were left without values. For *v2 only*, we can reorder these enums
so the non-deprecated values appear in the assembly. Note that we *cannot*
backport this to `master` (v1), because it would introduce breaking changes to
our Java/Go/Dotnet/Python customers.

* chore(release): 2.0.0-rc.33

Co-authored-by: Nick Lynch <nlynch@amazon.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: AWS CDK Team <aws-cdk@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants