-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat: construct base class changes (breaking) #1444
Conversation
Initial RFC for design of #1432
Adds CloudFormation resource metadata which enables tools such as SAM CLI to find local assets used by resources in the template. See design document under [design/code-asset-metadata.md](./design/code-asset-metadata.md) Fixes #1432
- Move all construct members (besides protected "validate") under "node" - Rename "parent" to "scope" - Rename "id" or "name" to "scid" (not sure about this one)
* When a construct is created, it is always added as a child | ||
*/ | ||
export class Construct { | ||
export class Node { |
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.
Can't help but feel that Node
is overly generic. ConstructNode
maybe, or even ConstructTree
?
Other than that, muy bien!
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.
You mean for the class name, sure. Are you with Construct#node
as the accessor?
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.
I would support both treeNode
and node
.
@rix0rrr @RomainMuller I am loving "scope", but not 100% comfortable with renaming "id" to "scid". How do you feel about it? |
The reason it feels wrong is because we are starting to see a pattern where this ID is used as a double for some other lower-level name/ID. For example, the name of a CodePipeline stage, the name of the Stack, ID of the Step Functions action, etc. On the other hand, due to the fact that these IDs cannot include deploy-time tokens, I am worried that people are going to abuse them and constantly fall into this error, so perhaps we should give them a wacky name so they will less likely be abused. |
I'm fine with leaving |
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.
I focused mainly on the Code* and general Construct changes. Everything looks good to me. I like the scope
naming, and especially the node
property - I think it will make the Sphinx docs a lot more helpful, without cluttering every single class with the Construct API.
Shift the conceptual mental model to talk about the scope hierarchy instead of a tree with parents and children. See aws/aws-cdk#1444
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
validate
) under anode
property so they don't pollute the surface area of derived classes (fixes constructs: reduce API clutter from base class #1441)IConstruct
and have allIXxx
extend itBREAKING CHANGE: Multiple breaking changes:
cdk.Construct
are now available underconstruct.node
(e.g. instead ofconstruct.path
useconstruct.node.path
. See constructs: reduce API clutter from base class #1441 for details.parent
was renamed toscope
. See construct: consider renaming "parent" to "scope" #1431 for more details.codepipeline.CrossRegionScaffoldStack
is now required.IPipeline.uniqueId
removed and can now be accessed viapipeline.node.uniqueId
.Pull Request Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.