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.
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 803c618c0d9e..ee71bf5c7cf6 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).",
@@ -1822,29 +1822,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"
}
}
}
@@ -1853,7 +1851,7 @@
}
},
"/unsupported": {
- "x-oai-additionalOperations": {
+ "additionalOperations": {
"FOO": {
"tags": [
"Test"
@@ -1884,51 +1882,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"
- }
- }
- }
}
}
}
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);
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.
diff --git a/src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs b/src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs
index 263de27af1a5..68523369c4bb 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,7 +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);
+ 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);
}