From 06828553cd3c50f69e9529874953b4ba80d967da Mon Sep 17 00:00:00 2001 From: Youssef Fahmy Date: Tue, 9 Jun 2026 17:20:39 +0200 Subject: [PATCH 1/6] Update default OpenApi version to 3.2 --- src/OpenApi/src/Services/OpenApiOptions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenApi/src/Services/OpenApiOptions.cs b/src/OpenApi/src/Services/OpenApiOptions.cs index 69e3638cd089..f5c334d71693 100644 --- a/src/OpenApi/src/Services/OpenApiOptions.cs +++ b/src/OpenApi/src/Services/OpenApiOptions.cs @@ -33,9 +33,9 @@ public OpenApiOptions() } /// - /// The version of the OpenAPI specification to use. Defaults to . + /// The version of the OpenAPI specification to use. Defaults to . /// - public OpenApiSpecVersion OpenApiVersion { get; set; } = OpenApiSpecVersion.OpenApi3_1; + public OpenApiSpecVersion OpenApiVersion { get; set; } = OpenApiSpecVersion.OpenApi3_2; /// /// The name of the OpenAPI document this instance is associated with. From 7c10fb4c062bead3420599fec127f4e3f95bbef9 Mon Sep 17 00:00:00 2001 From: Youssef Fahmy Date: Tue, 9 Jun 2026 17:23:48 +0200 Subject: [PATCH 2/6] Update GetDocumentCommandWorker.cs --- .../GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tools/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs b/src/Tools/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs index 0bd4ed9be2dd..675f3398de20 100644 --- a/src/Tools/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs +++ b/src/Tools/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs @@ -347,7 +347,7 @@ private string GetDocument( { _reporter.WriteWarning(Resources.FormatInvalidOpenApiVersion(_context.OpenApiVersion)); } - arguments = [documentName, writer, OpenApiSpecVersion.OpenApi3_1]; + arguments = [documentName, writer, OpenApiSpecVersion.OpenApi3_2]; } } using var resultTask = (Task)InvokeMethod(targetMethod, service, arguments); From a136138b2f85340f0752069d052809aec6d4f9b5 Mon Sep 17 00:00:00 2001 From: Youssef Fahmy Date: Tue, 9 Jun 2026 17:25:03 +0200 Subject: [PATCH 3/6] Update Resources.resx --- src/Tools/GetDocumentInsider/src/Resources.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tools/GetDocumentInsider/src/Resources.resx b/src/Tools/GetDocumentInsider/src/Resources.resx index 745edb2eb8c8..808e7c78a057 100644 --- a/src/Tools/GetDocumentInsider/src/Resources.resx +++ b/src/Tools/GetDocumentInsider/src/Resources.resx @@ -201,7 +201,7 @@ The name of the OpenAPI document to generate. Optional. - Invalid OpenAPI spec version '{0}' provided. Falling back to default: v3.1. + Invalid OpenAPI spec version '{0}' provided. Falling back to default: v3.2. Document with name '{0}' not found. From e941479fd762ee9992faf4a55ffe2610efb5a48f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 10 Jun 2026 10:25:13 +0000 Subject: [PATCH 4/6] Update localization snapshot for OpenAPI 3.2 default Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com> --- ...ifyOpenApiDocumentIsInvariant.verified.txt | 110 +++++++++--------- 1 file changed, 53 insertions(+), 57 deletions(-) diff --git a/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApiDocumentLocalizationTests.VerifyOpenApiDocumentIsInvariant.verified.txt b/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApiDocumentLocalizationTests.VerifyOpenApiDocumentIsInvariant.verified.txt index 6b19265f6e69..5869442da27c 100644 --- a/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApiDocumentLocalizationTests.VerifyOpenApiDocumentIsInvariant.verified.txt +++ b/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApiDocumentLocalizationTests.VerifyOpenApiDocumentIsInvariant.verified.txt @@ -1,5 +1,5 @@ { - "openapi": "3.1.2", + "openapi": "3.2.0", "info": { "title": "Sample | localized", "description": "This is a localized OpenAPI document for français (France).", @@ -1624,29 +1624,27 @@ } }, "/query": { - "x-oai-additionalOperations": { - "QUERY": { - "tags": [ - "Test" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/CurrentWeather" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CurrentWeather" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/CurrentWeather" - } + "query": { + "tags": [ + "Test" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/CurrentWeather" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CurrentWeather" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CurrentWeather" } } } @@ -1655,7 +1653,7 @@ } }, "/unsupported": { - "x-oai-additionalOperations": { + "additionalOperations": { "FOO": { "tags": [ "Test" @@ -1686,51 +1684,49 @@ } }, "/query-with-body": { - "x-oai-additionalOperations": { - "QUERY": { - "tags": [ - "Test" - ], - "requestBody": { + "query": { + "tags": [ + "Test" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MvcTodo" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/MvcTodo" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/MvcTodo" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", "content": { - "application/json": { + "text/plain": { "schema": { "$ref": "#/components/schemas/MvcTodo" } }, - "text/json": { + "application/json": { "schema": { "$ref": "#/components/schemas/MvcTodo" } }, - "application/*+json": { + "text/json": { "schema": { "$ref": "#/components/schemas/MvcTodo" } } - }, - "required": true - }, - "responses": { - "200": { - "description": "OK", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/MvcTodo" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/MvcTodo" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/MvcTodo" - } - } - } } } } From 5a26eb864617f645e2fadd2c92bd26245edaa938 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 10 Jun 2026 13:52:48 +0000 Subject: [PATCH 5/6] Fix GetDocumentInsider.Tests for OpenAPI 3.2 default Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com> --- src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs b/src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs index 263de27af1a5..f34361be4a68 100644 --- a/src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs +++ b/src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs @@ -40,7 +40,7 @@ public void GetDocument_Works() var result = OpenApiDocument.Load(stream, "json"); // TODO: Needs https://github.com/microsoft/OpenAPI.NET/issues/2055 to be fixed // Assert.Empty(result.Diagnostic.Errors); - Assert.Equal(OpenApiSpecVersion.OpenApi3_1, result.Diagnostic.SpecificationVersion); + Assert.Equal(OpenApiSpecVersion.OpenApi3_2, result.Diagnostic.SpecificationVersion); Assert.Equal("GetDocumentSample | v1", result.Document.Info.Title); } @@ -89,11 +89,11 @@ public void GetDocument_WithInvalidOpenApiVersion_Errors() ], new GetDocumentCommand(_console), throwOnUnexpectedArg: false); // Assert that error was produced and files were generated with v3. - Assert.Contains("Invalid OpenAPI spec version 'OpenApi4_0' provided. Falling back to default: v3.1.", _console.GetOutput()); + Assert.Contains("Invalid OpenAPI spec version 'OpenApi4_0' provided. Falling back to default: v3.2.", _console.GetOutput()); using var stream = new MemoryStream(File.ReadAllBytes(Path.Combine(outputPath.FullName, "Sample.json"))); var result = OpenApiDocument.Load(stream, "json"); Assert.Empty(result.Diagnostic.Errors); - Assert.Equal(OpenApiSpecVersion.OpenApi3_1, result.Diagnostic.SpecificationVersion); + Assert.Equal(OpenApiSpecVersion.OpenApi3_2, result.Diagnostic.SpecificationVersion); Assert.Equal("GetDocumentSample | v1", result.Document.Info.Title); } @@ -126,8 +126,7 @@ public void GetDocument_WithDocumentName_Works() using var stream = new MemoryStream(File.ReadAllBytes(Path.Combine(outputPath.FullName, "Sample_internal.json"))); var result = OpenApiDocument.Load(stream, "json"); Assert.Empty(result.Diagnostic.Errors); - Assert.Equal(OpenApiSpecVersion.OpenApi3_1, result.Diagnostic.SpecificationVersion); - // Document name in the title gives us a clue that the correct document was actually resolved + Assert.Equal(OpenApiSpecVersion.OpenApi3_2, result.Diagnostic.SpecificationVersion); Assert.Equal("GetDocumentSample | internal", result.Document.Info.Title); } From febec9621b3c71f70ad358c6926067581bc0360e Mon Sep 17 00:00:00 2001 From: Youssef Fahmy Date: Wed, 10 Jun 2026 15:56:16 +0200 Subject: [PATCH 6/6] Update GetDocumentTests.cs --- src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs b/src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs index f34361be4a68..68523369c4bb 100644 --- a/src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs +++ b/src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs @@ -127,6 +127,7 @@ public void GetDocument_WithDocumentName_Works() var result = OpenApiDocument.Load(stream, "json"); Assert.Empty(result.Diagnostic.Errors); Assert.Equal(OpenApiSpecVersion.OpenApi3_2, result.Diagnostic.SpecificationVersion); + // Document name in the title gives us a clue that the correct document was actually resolved Assert.Equal("GetDocumentSample | internal", result.Document.Info.Title); }