Skip to content

feat: adds support for additional operations emission in OpenAPI 3.2.0#67007

Open
baywet wants to merge 4 commits into
dotnet:mainfrom
baywet:feat/additional-operations
Open

feat: adds support for additional operations emission in OpenAPI 3.2.0#67007
baywet wants to merge 4 commits into
dotnet:mainfrom
baywet:feat/additional-operations

Conversation

@baywet
Copy link
Copy Markdown
Contributor

@baywet baywet commented Jun 3, 2026

follow up to #65714

CC @martincostello

Copilot AI review requested due to automatic review settings June 3, 2026 19:19
@baywet baywet requested a review from a team as a code owner June 3, 2026 19:19
@github-actions github-actions Bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Jun 3, 2026
Copy link
Copy Markdown
Contributor

Copilot AI 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

Note

Copilot was unable to run its full agentic suite in this review.

Extends OpenAPI generation and traversal to support custom HTTP methods (e.g., FOO) in addition to standard spec methods, and updates unit/integration snapshots accordingly.

Changes:

  • Allow ApiDescription.GetHttpMethod() to return custom HttpMethod instances instead of null for unknown methods.
  • Update OpenApiDocumentService.ForEachOperationAsync to iterate over all operations present on a path item (including custom methods).
  • Add/adjust tests and snapshot baselines to validate custom-method handling in generated documents.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Services/OpenApiDocumentService/OpenApiDocumentServiceTests.QueryMethod.cs Adds tests + a custom HttpMethodAttribute to verify custom methods appear and are visited in traversal.
src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApiDocumentLocalizationTests.VerifyOpenApiDocumentIsInvariant.verified.txt Updates expected snapshot output to include custom method under /unsupported.
src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApi3_2/OpenApiDocumentIntegrationTests.VerifyOpenApiDocument_documentName=controllers.verified.txt Updates OpenAPI 3.2 snapshot to include additionalOperations for custom method.
src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApi3_1/OpenApiDocumentIntegrationTests.VerifyOpenApiDocument_documentName=controllers.verified.txt Updates OpenAPI 3.1 snapshot to include custom method extension output.
src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApi3_0/OpenApiDocumentIntegrationTests.VerifyOpenApiDocument_documentName=controllers.verified.txt Updates OpenAPI 3.0 snapshot to include custom method extension output.
src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Extensions/ApiDescriptionExtensionsTests.cs Updates unit tests for custom methods and adds coverage for missing/blank HttpMethod strings.
src/OpenApi/src/Services/OpenApiDocumentService.cs Iterates over all operations in a path item instead of a fixed list of HTTP methods.
src/OpenApi/src/Services/OpenApiConstants.cs Removes pre-allocated HTTP method array no longer used by traversal logic.
src/OpenApi/src/Extensions/ApiDescriptionExtensions.cs Returns a custom HttpMethod for unknown methods; adds null/whitespace guard.

Comment thread src/OpenApi/src/Extensions/ApiDescriptionExtensions.cs
Comment thread src/OpenApi/src/Extensions/ApiDescriptionExtensions.cs Outdated
@baywet baywet requested a review from Copilot June 3, 2026 19:29
Copy link
Copy Markdown
Contributor

Copilot AI 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

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread src/OpenApi/src/Extensions/ApiDescriptionExtensions.cs
Comment thread src/OpenApi/src/Services/OpenApiDocumentService.cs
@baywet baywet requested a review from Copilot June 3, 2026 19:34
Copy link
Copy Markdown
Contributor

Copilot AI 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

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment on lines +166 to +172
if (pathItem.Operations is null)
{
var httpMethod = OpenApiConstants.HttpMethods[i];
if (pathItem.Operations is null || !pathItem.Operations.TryGetValue(httpMethod, out var operation))
{
continue;
}
continue;
}

foreach (var operation in pathItem.Operations.Values)
{
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot fix this comment

Comment thread src/OpenApi/src/Extensions/ApiDescriptionExtensions.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants