-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix: move reference interfaces to their own submodules #35971
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This review is outdated)
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
…ws-cdk into huijbers/centralized-l1-interfaces
|
➡️ PR build request submitted to A maintainer must now check the pipeline and add the |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks:You may have to fix your CI before adding the pull request to the queue again. |
|
@Mergifyio queue |
🛑 There are no queue conditions matchingThere are queue conditions defined in the configuration, but none matches. The pull request has not been embarked. Details:
|
|
@Mergifyio refresh |
✅ Pull request refreshed |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Comments on closed issues and PRs are hard for our team to see. |
The introduction of reference interfaces (
IBucketRef,IRoleRef, etc) led to an increased potential for cyclic references between service modules. Cyclic references are a problem in both Python and Go, and prevents us from taking this idea as far as we want to go.In this PR, we introduce a new submodule
aws-cdk-lib.interfaceswhere all reference interfaces will live. Because some services have resources with the same name, there are submodules inside theinterfacessubmodule, so actual interface references will look likeaws-cdk-lib.interfaces.aws_s3.IBucketRef.Because moving the canonical location for these interfaces will be breaking, we leave behind aliases for them in the old location, so TypeScript code can still do
import { IBucketRef } from 'aws-cdk-lib/aws-s3';. Unfortunately we cannot do the same for other languages because (a) jsii doesn't understand type aliases yet and (b) even if it did, type aliases can not be rendered appropriately in either Java or C#. This means that this change might be backwards breaking for some consumers that implement L2 interfaces in jsii client languages, but we are assuming that most people doing this would be using TypeScript which will remain unaffected. It is unfortunate that we have to do this, but we have painted ourselves into a corner that we otherwise cannot get out of.Implementation notes
This PR contains heavy refactoring in
spec2cdkaround determining file paths and import paths. We used to have to pass import paths into every service module that we code generated; but if we determine the file names ahead of time, we can also just usepath.posix.relative()to determine the right import location, which is much easier to use.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license