Skip to content

fix(library): avoid false circular refs for external schema re-exports#2874

Merged
baywet merged 1 commit into
support/v2from
fix/circular-ref-to-v2
Jun 9, 2026
Merged

fix(library): avoid false circular refs for external schema re-exports#2874
baywet merged 1 commit into
support/v2from
fix/circular-ref-to-v2

Conversation

@baywet

@baywet baywet commented Jun 9, 2026

Copy link
Copy Markdown
Member

port of #2873 to v2

Fixes #2872.

The false positive came from workspace schema registration preferring
item.Value.Id for component aliases. For OpenApiSchemaReference values,
reading Id eagerly dereferenced the external target during registration,
which triggered "Circular reference detected while resolving schema"
for a root schema re-export plus a direct external reference.

This faulty behavior traces back to PR #1826, which introduced the
item.Value.Id ?? fallback to support JSON Schema identifier-based
resolution. Under JSON Schema 2020-12, JSON Pointer still identifies a
lexical location in the containing document, but $id establishes the
canonical schema resource URI. This change preserves explicit $id alias
registration for concrete schemas while always registering component keys
for schema references so workspace registration does not resolve refs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@baywet baywet requested a review from a team as a code owner June 9, 2026 12:06
@baywet baywet self-assigned this Jun 9, 2026
@baywet baywet enabled auto-merge June 9, 2026 12:06
@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall coverage in the branch is 41%. The coverage in the branch is 88%.

Show a code coverage summary of the most impacted files.
File 21488c6 1bace68 +/-
/home/runner/wo...MapParameter.cs 100% 0% -100%
/home/runner/wo...Deserializer.cs 81% 0% -81%
/home/runner/wo...pyReferences.cs 63% 31% -32%
/home/runner/wo...piJsonReader.cs 100% 72% -28%
/home/runner/wo...Deserializer.cs 90% 62% -28%
/home/runner/wo...s/OpenApiTag.cs 100% 76% -24%
/home/runner/wo...Deserializer.cs 100% 81% -19%
/home/runner/wo...Deserializer.cs 96% 81% -15%
/home/runner/wo...Deserializer.cs 97% 89% -8%
/home/runner/wo...piComponents.cs 94% 87% -7%

Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

@baywet baywet merged commit a058913 into support/v2 Jun 9, 2026
18 of 19 checks passed
@baywet baywet deleted the fix/circular-ref-to-v2 branch June 9, 2026 18:45
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.

2 participants