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

API for getting the root node of the construct tree #3060

Closed
yoav-steinberg opened this issue Jun 26, 2023 · 5 comments
Closed

API for getting the root node of the construct tree #3060

yoav-steinberg opened this issue Jun 26, 2023 · 5 comments
Labels
✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl 🎨 sdk SDK

Comments

@yoav-steinberg
Copy link
Contributor

yoav-steinberg commented Jun 26, 2023

Feature Spec

Currently there's no way to get the root node of the construct tree. The following workaround can work, but it's ugly and non-intuitive:

class A {}
let root = new A().node.root

I suggest adding something like utils.rootNode() that does the same.

Use Cases

In some cases this can be useful. Once case is if you want set a custom scope (in) to of a preflight calss to the root node:

class BucketFactory() {
  init() {
    for i in 0..3 {
      new cloud.Bucket() as "bucket${i}" in utils.rootNode();
    }
  }
  new BucketFactyory();
}

Implementation Notes

No response

Component

SDK
Compiler

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@yoav-steinberg yoav-steinberg added the ✨ enhancement New feature or request label Jun 26, 2023
@monadabot monadabot added this to Wing Jun 26, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New - not properly defined in Wing Jun 26, 2023
@staycoolcall911 staycoolcall911 moved this from 🆕 New - not properly defined to 🤝 Backlog - handoff to owners in Wing Jun 26, 2023
@github-actions
Copy link

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@github-actions github-actions bot added the Stale label Aug 26, 2023
@staycoolcall911 staycoolcall911 added the needs-discussion Further discussion is needed prior to impl label Oct 4, 2023
Copy link

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@yoav-steinberg
Copy link
Contributor Author

I think we can use this.node.root and delete the issue, but:
I'm working on #4925, where I might need some way of getting the root construct when I don't have access to this. So it might be useful..

Copy link

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@yoav-steinberg
Copy link
Contributor Author

Closing in favor of #6058 which will cover this in any case.

@github-project-automation github-project-automation bot moved this from 🤝 Backlog - handoff to owners to ✅ Done in Wing Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl 🎨 sdk SDK
Projects
Status: Done
Development

No branches or pull requests

2 participants