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? |
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.
@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