Skip to content

fix: apply excludedPathMatcher during external resolution - #430

Open
HugoHSun wants to merge 1 commit into
APIDevTools:mainfrom
HugoHSun:hugo/exclude-paths-during-resolution
Open

fix: apply excludedPathMatcher during external resolution#430
HugoHSun wants to merge 1 commit into
APIDevTools:mainfrom
HugoHSun:hugo/exclude-paths-during-resolution

Conversation

@HugoHSun

@HugoHSun HugoHSun commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Closes #429

Summary

External references are resolved before the existing bundle and dereference exclusion matchers run. As a result, a literal $ref below an excluded path can still be downloaded or throw a resolution error.

This adds resolve.excludedPathMatcher so callers can stop traversal before external references are fetched.

The matcher now also receives the value at the current path:

excludedPathMatcher?(path: string, value?: unknown): boolean;

The value is useful when a document contains both intentional internal references and literal external $ref properties in the same section. Callers can preserve the literal value without excluding every reference below that path.

Bundling now checks direct child values as well as containers. This ensures a matching $ref is skipped before it enters the bundle inventory.

Existing path-only matchers remain compatible because the second argument is optional.

Testing

  • Added external file and HTTP refs below excluded paths to confirm they are not resolved.
  • Added bundle coverage for excluded direct child refs.
  • Added a value-aware matcher case that resolves an internal ref while preserving an external $ref and its sibling properties.

@HugoHSun
HugoHSun marked this pull request as ready for review August 13, 2026 08:51
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.

Apply excludedPathMatcher before resolving external references

1 participant