feat: add target to the filter-in and filter-out decorators#2570
Open
feat: add target to the filter-in and filter-out decorators#2570
Conversation
🦋 Changeset detectedLatest commit: 649abfd The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
|
b80cdea to
e44a257
Compare
tatomyr
commented
Feb 18, 2026
docs/@v2/decorators/filter-in.md
Outdated
| | value | [string] | **REQUIRED.** List of values used for the matching. | | ||
| | matchStrategy | string | Possible values: `all`, `any`. If `all` it needs to match all of the values supplied. If `any` it needs to match only one of the values supplied. Default value: `any`. | | ||
| | target | string | Possible values: `PathItem`, `Operation`. When set, filtering is scoped to the specified target. | | ||
| | noPropertyStrategy | string | Possible values: `keep`, `remove` (default value: `keep`). Decides whether to keep nodes without the specified property when `target` is set. | |
Collaborator
Author
There was a problem hiding this comment.
The default still looks wrong to me.
Collaborator
Author
There was a problem hiding this comment.
I'd rather suggest removing this and line 22, and always remove target nodes with no property that we're filtering-in by. (It even sounds much more logical to filter-in only nodes with the matching propery+value.)
To me, this aligns better with the filter-out logic. What do you think?
bddb2b6 to
83012a6
Compare
JLekawa
reviewed
Feb 19, 2026
JLekawa
approved these changes
Feb 19, 2026
…initial implementation
62d94a1 to
d309a86
Compare
JLekawa
approved these changes
Feb 20, 2026
JLekawa
reviewed
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What/Why/How?
Added new options to the
filter-inandfilter-outdecorators, allowing to filter through a specific target nodes (PathItemorOperation).This solves an issue where users want to filter in/out specific nodes (i.e. Operations) and leave other nodes that might contain the
propertyuntouched (for instance, in Schemas). However, with the current implementation of filter-in/out we cannot scope where to look by nodes, only by specifying theproperty, so the decorator walks through all nodes looking for the specified property.A note for reviewers: I'm still not convinced that we need
noPropertyStrategyoption infilter-in. For me it seems natural that we don't keep a node that doesn't match the specified property when filtering in.Reference
Resolves #2464
Related contribution: #2536
Alters #2555.
Testing
Screenshots (optional)
Check yourself
Security