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

Add :recursive selector function #2353

Merged
merged 1 commit into from
Aug 28, 2024
Merged

Add :recursive selector function #2353

merged 1 commit into from
Aug 28, 2024

Conversation

mtdowling
Copy link
Member

@mtdowling mtdowling commented Jul 19, 2024

Closes #2228

Background

  • Adds a recursive selector function to do things like check if a shape has a specific mixin or if a shape is in the hierarchy of a resource.

Testing

  • Added selector tests, and manually tested

The following example finds all shapes that have a specific mixin:

:test(:recursive(-[mixin]->) [id=smithy.example#Foo])

The following selector finds shapes that are contained within the resource hierarchy of a specific resource.

resource :test(:recursive(<-[resource]-) [id=smithy.example#Baz])

The following selector finds all shapes that directly or transitively target a specific shape, essentially the inverse of ~>.

[id=smithy.example#MyShape] :recursive(<)

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

docs/source-2.0/spec/selectors.rst Outdated Show resolved Hide resolved
docs/source-2.0/spec/selectors.rst Outdated Show resolved Hide resolved
@kstich kstich merged commit 3fc9d3d into main Aug 28, 2024
14 checks passed
@kstich kstich deleted the recursive-function branch August 28, 2024 18:15
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.

Selectors: recursive mixin check?
4 participants