-
Notifications
You must be signed in to change notification settings - Fork 10.6k
feat: adds support for OpenAPI 3.2.0 #65415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for your PR, @@baywet. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
| "$ref": "#/components/schemas/NullableResponseModel" | ||
| } | ||
| ] | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change in shape is due to a bugfix in the library microsoft/OpenAPI.NET#2645
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds support for OpenAPI 3.2.0 by upgrading the Microsoft.OpenApi NuGet packages from version 2.0.0 to 3.3.1 and updating the default OpenAPI specification version from 3.1 to 3.2. The PR makes necessary code adaptations to work with the upgraded library's API changes.
Changes:
- Upgrades Microsoft.OpenApi and Microsoft.OpenApi.YamlReader packages from 2.0.0 to 3.3.1
- Changes default OpenAPI specification version from OpenApi3_1 to OpenApi3_2
- Adapts code to API changes in the library (Dictionary<string, OpenApiMediaType> → Dictionary<string, IOpenApiMediaType>)
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| eng/Versions.props | Updates Microsoft.OpenApi package versions from 2.0.0 to 3.3.1 |
| src/OpenApi/src/Services/OpenApiOptions.cs | Changes default OpenAPI version from OpenApi3_1 to OpenApi3_2 |
| src/OpenApi/src/Services/OpenApiGenerator.cs | Adapts to library API change for Content dictionary types |
| src/OpenApi/src/Services/OpenApiDocumentService.cs | Adapts to library API change for Content dictionary types |
| src/OpenApi/gen/XmlCommentGenerator.Emitter.cs | Adds .OfType() filtering when iterating Content values |
| src/Tools/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs | Updates default fallback version to OpenApi3_2 |
| src/Tools/GetDocumentInsider/tests/GetDocumentTests.cs | Updates test assertions to expect OpenApi3_2 |
| src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Transformers/CustomSchemaTransformerTests.cs | Adapts test setup to use IOpenApiMediaType dictionary type |
| src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Extensions/OpenApiEndpointRouteBuilderExtensionsTests.cs | Updates version string assertions from "3.1.1" to "3.1.2" |
| src/OpenApi/test/Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests/snapshots/*.cs | Updates generated code to use .OfType() pattern |
| src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApi3_1/*.txt | Updates version string from "3.1.1" to "3.1.2" in snapshots |
| src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApi3_0/OpenApiDocumentIntegrationTests.VerifyOpenApiDocument_documentName=schemas-by-ref.verified.txt | Updates nullable schema structure from library changes |
| src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApiDocumentLocalizationTests.VerifyOpenApiDocumentIsInvariant.verified.txt | Updates version from "3.1.1" to "3.2.0" for default version |
| /// 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; |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default OpenAPI version has been changed to OpenApi3_2, but there are no integration tests or snapshot files for this version. The integration tests (in OpenApiDocumentIntegrationTests.cs) only test OpenApi3_0 and OpenApi3_1, and there is no OpenApi3_2 snapshot directory. Before making OpenApi3_2 the default, comprehensive tests and snapshots should be added to ensure the new version works correctly.
| var responseString = Encoding.UTF8.GetString(responseBodyStream.ToArray()); | ||
| // String check to validate that generated document starts with YAML syntax | ||
| Assert.Equal(isYaml, responseString.StartsWith("openapi: '3.1.1'", StringComparison.OrdinalIgnoreCase)); | ||
| Assert.Equal(isYaml, responseString.StartsWith("openapi: '3.1.2'", StringComparison.OrdinalIgnoreCase)); |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expected OpenAPI version string has been changed from "3.1.1" to "3.1.2". Please verify that "3.1.2" is a valid OpenAPI specification version. According to the OpenAPI specification, version 3.1.1 exists, but version 3.1.2 may not be an official spec release. This could indicate an issue with the Microsoft.OpenApi library version being used.
| Assert.Equal(isYaml, responseString.StartsWith("openapi: '3.1.2'", StringComparison.OrdinalIgnoreCase)); | |
| Assert.Equal(isYaml, responseString.StartsWith("openapi: '3.1.1'", StringComparison.OrdinalIgnoreCase)); |
| var responseString = Encoding.UTF8.GetString(responseBodyStream.ToArray()); | ||
| // String check to validate that generated document starts with YAML syntax | ||
| Assert.Equal(isYaml, responseString.StartsWith("openapi: '3.1.1'", StringComparison.OrdinalIgnoreCase)); | ||
| Assert.Equal(isYaml, responseString.StartsWith("openapi: '3.1.2'", StringComparison.OrdinalIgnoreCase)); |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expected OpenAPI version string has been changed from "3.1.1" to "3.1.2". Please verify that "3.1.2" is a valid OpenAPI specification version. According to the OpenAPI specification, version 3.1.1 exists, but version 3.1.2 may not be an official spec release. This could indicate an issue with the Microsoft.OpenApi library version being used.
| Assert.Equal(isYaml, responseString.StartsWith("openapi: '3.1.2'", StringComparison.OrdinalIgnoreCase)); | |
| Assert.Equal(isYaml, responseString.StartsWith("openapi: '3.1.1'", StringComparison.OrdinalIgnoreCase)); |
fixes #63754
a subsequent pull request(s) will be required to take advantage of the new capabilities like item schema for streaming events