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

Easy access to nested resource local name #1922

Closed
allanlw opened this issue Mar 18, 2021 · 2 comments
Closed

Easy access to nested resource local name #1922

allanlw opened this issue Mar 18, 2021 · 2 comments
Labels
enhancement New feature or request Needs: Triage 🔍

Comments

@allanlw
Copy link

allanlw commented Mar 18, 2021

As of now, there does not seem to be a way to access a nested scoped name easily.

E.g. if I have resource 'foo' with name 'example1' that has nested resource 'bar' with name 'example2', bar.name evaluates to example1/example2. There is no property on bar that returns just 'example2'.

@allanlw allanlw added the enhancement New feature or request label Mar 18, 2021
@ghost ghost added the Needs: Triage 🔍 label Mar 18, 2021
@alex-frankel
Copy link
Collaborator

This will be resolved in our next release (hopefully today or tomorrow), which has #1516 and #1800 checked-in. Then you can do either:

nested style:

resource foo '...' = {
  name: 'example1'

  resource bar '...' = {
    name: 'example2'
  }
}

var childName = foo::bar.name // childName = example2

parent style:

resource foo '...' = {
  name: 'example1'
}

resource bar '...' = {
  parent: foo
  name: 'example2'
}

var childName = bar.name // childName = example2

@allanlw
Copy link
Author

allanlw commented Mar 18, 2021

Ah, saw those but didn't realize this would change the name property like that. I'll close this.

@allanlw allanlw closed this as completed Mar 18, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request Needs: Triage 🔍
Projects
None yet
Development

No branches or pull requests

2 participants