Repository navigation
feat: filter operations to hide internal endpoints - #18
Merged
Merged
Conversation
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.
Summary
filterconfig, global (merge.filter) and per source (sources[].filter), withinclude(allow-list) andexcluderules. A rule matches an operation by path glob, tag,operationId, or a truthy vendor extension (x-internal) on the operation or its path item./internal/metricsunder the defaulterrorstrategy).discriminator.mappingtargets are handled. Things that were never referenced to begin with are left alone, and sections or lists emptied by pruning are dropped.Semantics
excluderules from both levels apply andexcludewins.includerules from both levels must all match (they narrow).*matches within one path segment,**across segments;{id}is literal. Globs do not apply towebhooks.parameters) stay while any operation remains.pathsnot starting with/, extensions not starting withx-, empty tag or operation-id strings.Notes
SourceandMergeConfiggain afilterfield. That is a small breaking change for library users who construct them by hand.servers,infoor vendor extensions, which the README says explicitly. External documents referenced only by hidden operations are still loaded.serde_json::Map::removewithpreserve_orderis a swap-remove and reordered surviving paths; the filter uses an order-preserving removal.Test plan
cargo test --workspace(config validation, glob and rule matching, removal semantics, pruning including cycles and discriminator mappings,filter_sourcecombining levels, CLI end-to-end where two services both expose/internal/metrics, source-level include, and the unfiltered config still conflicting, wasm test)cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --checkcd web && npm test(82 tests, including that the example's output contains no trace of the hidden endpoints),npm run typecheck,npm run e2e