Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update Microsoft.OpenApi to 3.0.0#64368

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
martincostello wants to merge1 commit intodotnet:main
base:main
Choose a base branch
Loading
frommartincostello:openapi-3.2

Conversation

@martincostello
Copy link
Member

@martincostellomartincostello commentedNov 14, 2025
edited
Loading

Update Microsoft.OpenApi to 3.0.0

Update Microsoft.OpenApi to 3.0.0 for basic OpenAPI 3.2 support.

Description

Update toMicrosoft.OpenApi@3.0.0 to add basic support for OpenAPI 3.2 and fix compilation errors when trying to use v3 in an ASP.NET Core application.

I'm not sure what exact other changes may be required for full OpenAPI 3.2 compatibility at this stage, but this at least resolves the runtime errors when using Microsoft.OpenApi 3.0.0.

One change that needs some thought is for example that HTTP QUERY is now supported in OpenAPI 3.2:

publicstaticHttpMethod?GetHttpMethod(thisApiDescriptionapiDescription)=>
apiDescription.HttpMethod?.ToUpperInvariant()switch
{
// Only add methods documented in the OpenAPI spec: https://spec.openapis.org/oas/v3.1.1.html#path-item-object
"GET"=>HttpMethod.Get,
"POST"=>HttpMethod.Post,
"PUT"=>HttpMethod.Put,
"DELETE"=>HttpMethod.Delete,
"PATCH"=>HttpMethod.Patch,
"HEAD"=>HttpMethod.Head,
"OPTIONS"=>HttpMethod.Options,
"TRACE"=>HttpMethod.Trace,
_=>null,
};

It's trivial enough to extend this method to handle QUERY, but then how do we skip it here when the document is going to be serialized in a version that's too low to allow it?

if(description.GetHttpMethod()is not{}method)
{
// Skip unsupported HTTP methods
continue;
}

It also appears that both swagger-ui and redoc don't yet support OpenAPI 3.2:

Contributes to#64317.

Update to `Microsoft.OpenApi@3.0.0` to add basic support for OpenAPI 3.2 and fix compilation errors.Relates todotnet#64317.
CopilotAI review requested due to automatic review settingsNovember 14, 2025 15:15
@martincostellomartincostello marked this pull request as draftNovember 14, 2025 15:15
@github-actionsgithub-actionsbot added the needs-area-labelUsed by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically labelNov 14, 2025
@martincostellomartincostello removed the needs-area-labelUsed by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically labelNov 14, 2025
@martincostellomartincostello added feature-openapi area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etc labelsNov 14, 2025
@dotnet-policy-servicedotnet-policy-servicebot added the community-contributionIndicates that the PR has been added by a community member labelNov 14, 2025
@dotnet-policy-service
Copy link
Contributor

Thanks for your PR, @@martincostello. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

Copilot finished reviewing on behalf ofmartincostelloNovember 14, 2025 15:17
Copy link
Contributor

CopilotAI left a 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 PR updates the Microsoft.OpenApi package from version 2.0.0 to 3.0.0 to add basic support for OpenAPI 3.2 and resolve runtime errors when using the updated library in ASP.NET Core applications.

  • Updated Microsoft.OpenApi and Microsoft.OpenApi.YamlReader package versions to 3.0.0
  • Changed dictionary types fromDictionary<string, OpenApiMediaType> toDictionary<string, IOpenApiMediaType> to match the new API
  • Added defensive type checking when accessing media type properties
  • Added OpenAPI 3.2 spec version support and corresponding test snapshots

Reviewed Changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
eng/Versions.propsUpdated Microsoft.OpenApi and Microsoft.OpenApi.YamlReader from 2.0.0 to 3.0.0
src/OpenApi/src/Services/OpenApiDocumentService.csChanged Content dictionary type from OpenApiMediaType to IOpenApiMediaType
src/OpenApi/src/Services/OpenApiGenerator.csChanged Content dictionary type from OpenApiMediaType to IOpenApiMediaType
src/OpenApi/gen/XmlCommentGenerator.Emitter.csAdded type checking when setting Example property on media types
src/OpenApi/test/.../CustomSchemaTransformerTests.csUpdated test code to use IOpenApiMediaType interface
src/OpenApi/test/.../OpenApiDocumentIntegrationTests.csAdded OpenApi3_2 spec version to test data
src/OpenApi/test/.../OpenApiEndpointRouteBuilderExtensionsTests.csUpdated OpenAPI version string from 3.1.1 to 3.1.2 in assertions
src/OpenApi/test/.../snapshots/OpenApi3_1/*.verified.txtUpdated OpenAPI version from 3.1.1 to 3.1.2 in snapshot files
src/OpenApi/test/.../snapshots/OpenApi3_2/*.verified.txtAdded new snapshot files for OpenAPI 3.2.0 spec version
src/OpenApi/test/.../snapshots/*#OpenApiXmlCommentSupport.generated.verified.csAdded type checking when setting Example property in generated code
src/OpenApi/test/.../OpenApiDocumentLocalizationTests.VerifyOpenApiDocumentIsInvariant.verified.txtUpdated OpenAPI version from 3.1.1 to 3.1.2

@desjoerd
Copy link
Contributor

I'm not sure what exact other changes may be required for full OpenAPI 3.2 compatibility at this stage, but this at least resolves the runtime errors when using Microsoft.OpenApi 3.0.0.

When looking through the OpenAPI 3.1 to 3.2 stepshttps://learn.openapis.org/upgrading/v3.1-to-v3.2#migration-checklist and going through the spec, it doesn't look like there are any real breaking changes. So it really looks like a real minor release 😎.

martincostello reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@captainsafiacaptainsafiaAwaiting requested review from captainsafiacaptainsafia is a code owner

@wtgodbewtgodbeAwaiting requested review from wtgodbewtgodbe is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etccommunity-contributionIndicates that the PR has been added by a community memberfeature-openapi

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@martincostello@desjoerd

[8]ページ先頭

©2009-2025 Movatter.jp