When dynamicScope has no entry for an anchor, resolveDynamicRef scans all components.schemas on every call. For specs with many $dynamicRefs, this is O(numDynamicRefs × numSchemas).
Two improvements:
- Cache — lazily build a
Map<anchorName, string[]> on the context so the scan runs once per spec
- Short-circuit — track first match + count instead of collecting all matches; bail early when ambiguous
Location: packages/core/src/resolvers/ref.ts around line 456-475.
When
dynamicScopehas no entry for an anchor,resolveDynamicRefscans allcomponents.schemason every call. For specs with many$dynamicRefs, this is O(numDynamicRefs × numSchemas).Two improvements:
Map<anchorName, string[]>on the context so the scan runs once per specLocation:
packages/core/src/resolvers/ref.tsaround line 456-475.