-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat: property injectors and make all L2 Constructors injectable #34419
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
### Issue # (if applicable) This Implements the Property Injectors RFC. https://github.com/aws/aws-cdk-rfcs/blob/main/text/0693-property-injection.md ### Reason for this change Implement the Property Injectors feature so orgs can set up default Construct props values. ### Description of changes Key changes: * propertyInjectionDecorator to make a Construct Property Injectable. * applyInjectors is called from Construct's constructor to inject property defaults. * IPropertyInjector defines an Property Injector. * PropertyInjectors class that stores the map of Constructs to Injectors. * App, Stage, and Stack now has a new propertyInjectors property. ### Describe any new or updated permissions being added None ### Description of how you validated changes * Unit test in core/test/prop-injectors.test.ts * Use `yarn package --target js` to create a library and write Injectors for Constructs. ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…#34328) ### Issue # (if applicable) This is a followup to aws#33887. DO NOT merge this PR until after 33887 is merged. ### Reason for this change In the original Property Injection PR, we enabled 122 Constructs for Property Injections, but we want to make this feature available for all L2 Constructs. ### Description of changes Add logic to Constructs ConstructsUpdater to if a Construct already have PROPERTY_INJECTION_ID property. If not, it will: - Add PROPERTY_INJECTION_ID with value that is calculated from path and class name - Import aws-cdk-lib/core/lib/prop-injectable - Add class decorator @propertyInjectable ### Describe any new or updated permissions being added No permission change. ### Description of how you validated changes - Added unit tests and ran `npm test` - Ran `./bin/update-construct-metadata` locally and manually verified a few random files. ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
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.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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. |
Reason for this change
This implements this RFC: https://github.com/aws/aws-cdk-rfcs/blob/main/text/0693-property-injection.md
Description of changes
This PR contains these changes:
Describe any new or updated permissions being added
No new IAM permission.
Description of how you validated changes
Added unit tests and integ tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license