Skip to content

Fix mapping for nested schemas and [Produces] attributes in OpenAPI implementation - #57852

Merged
wtgodbe merged 4 commits into
release/9.0from
safia/openapi-bug-fixes
Sep 16, 2024
Merged

wtgodbe merged 4 commits into
release/9.0from
safia/openapi-bug-fixes

Conversation

@captainsafia

Copy link
Copy Markdown
Contributor

Description

This PR consists of two changes to address feedback received after .NET 9 RC 1 for the new APIs in the Microsoft.AspNetCore.OpenApi package.

  • Resolves a bug where a [Produces] attribute with no-type would override the schema for a pre-existing schema by replacing direct assignment for content types with TryAdd in OpenApiDocumentService.GetResponseAsync.
  • Adds sub-schemas recursively into the schema-by-reference cache by updating OpenApiSchemaStore.PopulateSchemaIntoReferenceCache.

Fixes #57799

Customer Impact

This PR resolves issues reported in the OpenAPI implementation that don't currently have any viable workarounds for users. Without these changes, documents generated by this implementation may unintentionally drop schemas for responses generated controller actions with certain attributes. This change also stabilizes the generations of schema names for deeply nested type hierarchies in the OpenAPI document.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Changes in this PR only impact the Microsoft.AspNetCore.OpenApi and don't affect any APIs in the shared framework. Changes are in new code paths that were introduced in .NET 9 so there is no risk of version-to-version regression.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

Loading
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 area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-openapi Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants