Update default OpenApi version to 3.2 - #67097
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the default OpenAPI specification version used by Microsoft.AspNetCore.OpenApi.OpenApiOptions to 3.2, so apps that don’t explicitly configure a version will emit OpenAPI 3.2 documents by default.
Changes:
- Update
OpenApiOptions.OpenApiVersiondefault fromOpenApi3_1toOpenApi3_2. - Update the corresponding XML doc comment to reflect the new default.
| /// <summary> | ||
| /// The version of the OpenAPI specification to use. Defaults to <see cref="OpenApiSpecVersion.OpenApi3_1"/>. | ||
| /// The version of the OpenAPI specification to use. Defaults to <see cref="OpenApiSpecVersion.OpenApi3_2"/>. | ||
| /// </summary> | ||
| public OpenApiSpecVersion OpenApiVersion { get; set; } = OpenApiSpecVersion.OpenApi3_1; | ||
| public OpenApiSpecVersion OpenApiVersion { get; set; } = OpenApiSpecVersion.OpenApi3_2; |
|
I checked (because I couldn't remember) and swagger-ui supports OpenAPI 3.2 now: Swagger launches support for OpenAPI 3.2.0. Redoc doesn't yet: Redocly/redoc#2746 |
baywet
left a comment
There was a problem hiding this comment.
LGTM 🚀
(I had a reminder to submit a similar PR on July 15 so we don't miss the last preview boat)
|
@Youssef1313 And you can mark this PR as fixing #65490 |
|
@copilot Run OpenApi tests and fix the test failures. |
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Done. The failing test was |
|
@copilot Fix GetDocumentInsider.Tests failures as well. |
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Fixed in the latest commit. Updated three assertions in |
DeagleGross
left a comment
There was a problem hiding this comment.
We probably should announce this as breaking change: dotnet/AspNetCore.Docs#37228
|
Thanks for identifying a breaking change. no assignees, after you commit this PR please take the following actions, as part of the breaking changes announcement process:
|
Good point. I looked now at https://learn.microsoft.com/en-us/aspnet/core/breaking-changes/10/overview?view=aspnetcore-10.0 and there was no mention of a breaking change of switch from 2.x to 3.1 (it was done early in .NET 10, in Preview 1 I think). But I agree this should have been documented for .NET 10 (and should be for .NET 11 as well) |
|
@DeagleGross @mikekistler Do we need an announcement in aspnet/Announcements repo? or just docs in AspNetCore.Docs repo? |
@Youssef1313 We typically do both. Also, we should add guidance in the .NET 10 to .NET 11 migration guide for ASP.NET Core in the ASP.NET Core docs. |
@danroth27 Thanks, I'll make sure to create the announcement and update the docs once this PR merges. |
|
@mikekistler @danroth27 Announcement: aspnet/Announcements#530 |
|
@danroth27 Azure APIM doesn't yet fully support OpenAPI 3.1. I think this is a nice change, but it would be great if you could ping the APIM folks to get them to support this latest standard (and 3.1 while they're at it). https://learn.microsoft.com/en-us/azure/api-management/api-management-api-import-restrictions |
|
@nycdotnet thanks for sharing this. I've been working with the APIM team for the better part of a year now to get them to upgrade Microsoft.OpenAPI so the service supports newer versions of OpenAPI (both ingestion and emission). This is currently in internal preview and being tested out before broader release. I don't have any timelines to share. |
|
@baywet amazing thank you. |
This updates the default OpenApi version to 3.2.
I think we are late enough in previews to take this change and have enough time to receive user feedback.
Announcement: aspnet/Announcements#530
@halter73 @baywet @mikekistler @danroth27
Description
Updates the default OpenAPI specification version in
OpenApiOptions.OpenApiVersionfromOpenApi3_1toOpenApi3_2. Apps that don't explicitly configure a version will now emit OpenAPI 3.2 documents by default. The invalid-version fallback inGetDocumentCommandWorkernow also falls back toOpenApi3_2instead ofOpenApi3_1.Motivation and Context
We are far enough along in the preview cycle to take this change and gather user feedback on the OpenAPI 3.2 default.
Testing
OpenApiDocumentLocalizationTests.VerifyOpenApiDocumentIsInvariantsnapshot to reflect the new 3.2 output, including:3.1.2to3.2.0"query") in OpenAPI 3.2, rather than as an"x-oai-additionalOperations"extension used in 3.1GetDocumentInsider.Testsassertions fromOpenApi3_1toOpenApi3_2(default document, invalid-version fallback, and document-by-name tests) and the error message from "v3.1" to "v3.2"GetDocumentInsider.TestspassAdditional context