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

RFC 0693: Property injectors #699

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

pcheungamz
Copy link

This is a request for comments about Set Default Values to Construct Properties using PropertyInjector. See #693 for
additional details.

APIs are signed off by @{rix0rrr}.


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


`IPropertyInjector` - An IPropertyInjector defines a way to inject additional properties that are not specified in the props. It is specific to one Construct and operates on that Construct’s properties. This will be called `Injector` for short.

`propertyInjectors` - A collection of Injectors attached to App, Stage, or Stack. Any matching Construct created in this App, Stage, or Stack will have the Injector applied to it.
Copy link

@moelasmar moelasmar Feb 22, 2025

Choose a reason for hiding this comment

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

I believe we also agreed on that the injectors can be also attached to any construct. It can be attached to any node in the scope tree.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I have an example of that in the FAQ. The common way is to attach them to App, Stage, or Stack.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please write something to clarify that here, it confuses me every time I read it. You can try verbiage like the following:

A collection of injectors attached to the construct tree. Injectors can be attached to any construct, but in practice we expect most of them will be attached to App, Stage or Stack.

That acknowledges both the genericity of the proposed solution as well as the expected use cases.

Copy link
Author

Choose a reason for hiding this comment

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

will do. thanks

moelasmar
moelasmar previously approved these changes Feb 22, 2025
@mergify mergify bot dismissed moelasmar’s stale review February 25, 2025 05:48

Pull request has been modified.

@rix0rrr rix0rrr changed the title Blueprint RFC RFC 0693: Property injectors Feb 25, 2025
@rix0rrr rix0rrr changed the title RFC 0693: Property injectors RFC 0693: Property injection and construct blueprints Feb 25, 2025
@rix0rrr rix0rrr changed the title RFC 0693: Property injection and construct blueprints RFC 0693: Property injectors Feb 25, 2025
@@ -0,0 +1,468 @@
# Blueprint via Property Injection
Copy link
Contributor

Choose a reason for hiding this comment

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

This document is proposing "blueprints" and "property injection" at the same time.

I think the reader would benefit from a small definition of both terms and how they relate.

Copy link
Author

Choose a reason for hiding this comment

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

I try to define that in line 7.

Blueprint is a way for orgs to enforce standards by setting default values to CDK Constructs.  The Blueprint standards can be shared and applied to many development teams.  This is done via injecting default property values at creation time.

What is a better way to communicate this?

Copy link
Contributor

@rix0rrr rix0rrr Feb 27, 2025

Choose a reason for hiding this comment

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

I would phrase it as something like:

This document describes the mechanism of property injection, which is ...

This mechanism allows the implementation of blueprints, which are ...

The trick is now to define "blueprints" in a way that is substantially different enough from "applied property injectors" to add descriptive value.

I wonder if that's even possible, and if it's not just distracting. It might come down to "blueprints are a branded term for a particular library of property injectors"... which... fair enough, but is that worth describing in this doc?


`IPropertyInjector` - An IPropertyInjector defines a way to inject additional properties that are not specified in the props. It is specific to one Construct and operates on that Construct’s properties. This will be called `Injector` for short.

`propertyInjectors` - A collection of Injectors attached to App, Stage, or Stack. Any matching Construct created in this App, Stage, or Stack will have the Injector applied to it.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please write something to clarify that here, it confuses me every time I read it. You can try verbiage like the following:

A collection of injectors attached to the construct tree. Injectors can be attached to any construct, but in practice we expect most of them will be attached to App, Stage or Stack.

That acknowledges both the genericity of the proposed solution as well as the expected use cases.

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.

3 participants