fix: External Refs with same name are ignored (#2055) - #2382
Open
ewaostrowska wants to merge 1 commit into
Open
Conversation
ewaostrowska
force-pushed
the
issue-2055
branch
from
August 18, 2026 13:23
870f802 to
587694b
Compare
Contributor
Author
|
The solution maintains the different approach to the key sensitivity in between schema and non-schema components. For schema component: For I have decided to keep this separation as this would be a breaking change for the users and therefore if such appraoch is confirmed I would prefer to see it in a major version. |
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.
Pull Request
Description
When two external files each define a component with the same local name (e.g., both expose a schema called
limit), the parser was silently discarding the second definition and pointing both usages at the first. This caused incorrect, incomplete resolved documents that were hard to diagnose because no error or warning was emitted. The same problem applied to all component types (schemas, parameters, responses, request bodies, headers, security schemes, links, examples, callbacks).What was broken
Same-name external components were merged into one, losing data:
What changed
ExternalRefProcessor— replaced the ad-hoc, per-type name-collision logic with a single call toComponentNameAllocator.allocate(...). The old code had a different (buggy) implementation duplicated for every component type; the new code is a single loop that appends_Nsuffixes until a free or reusable slot is found.ComponentNameAllocator(new class) — centralises name allocation for all OpenAPI component maps. Uses pluggable policies for key lookup (exact vs. case-insensitive), ref-equivalence (delegated toResolverCache), and value-equality reuse. Schemas use case-insensitive key lookup (matching existing behaviour); all other component types use exact-case keys.Fixes: #2055
Type of Change
Checklist
Screenshots / Additional Context