Skip to content

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 8, 2025

Backport of #63511 to release/10.0
/cc @captainsafia @desjoerd

OpenAPI: Fix Circular reference in specific order gives empty schema

Summary of the changes (Less than 80 chars)
Fix circular reference resolution to prevent empty schemas regardless of property order

Description

This PR fixes an issue in the OpenAPI schema generation service where circular references could result in empty schemas for referenced types depending on the order of property declarations. The fix changes the schema reference resolution logic from using AddOpenApiSchemaByReference to directly creating OpenApiSchemaReference objects

Fixes #63503

Customer Impact

Customers using ASP.NET Core's OpenAPI generation with models containing circular references may experience incomplete or empty schemas in their OpenAPI documents, particularly when the order of properties affects schema processing. We can consider this a follow-on the the circular reference fixes that we included in .NET 10 Preview 7.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

This is a targeted fix that only changes the reference creation mechanism without affecting the broader schema generation architecture. The change is minimal and there's existing and new test coverage in the space.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@github-actions github-actions bot requested review from captainsafia and a team as code owners September 8, 2025 17:46
@captainsafia captainsafia added Servicing-consider Shiproom approval is required for the issue feature-openapi area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc labels Sep 8, 2025
@danmoseley danmoseley added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Sep 8, 2025
@wtgodbe wtgodbe enabled auto-merge (squash) September 8, 2025 20:33
@wtgodbe wtgodbe merged commit 8ae9e7c into release/10.0 Sep 8, 2025
28 checks passed
@wtgodbe wtgodbe deleted the backport/pr-63511-to-release/10.0 branch September 8, 2025 20:49
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-rc2 milestone Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-openapi Servicing-approved Shiproom has approved the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants