From 7fb7268d732647eeb6d2568376f8baee04c76f83 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Nov 2025 21:47:01 +0000 Subject: [PATCH 1/2] Initial plan From 1ba5ab48627dc5f3a32b9e57bb3aeda89b4fa3bc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Nov 2025 21:59:35 +0000 Subject: [PATCH 2/2] Fix case-insensitive group name matching in OpenAPI Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com> --- src/OpenApi/src/Services/OpenApiOptions.cs | 2 +- .../OpenApiDocumentServiceTests.Paths.cs | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/OpenApi/src/Services/OpenApiOptions.cs b/src/OpenApi/src/Services/OpenApiOptions.cs index e0347229baf1..69e3638cd089 100644 --- a/src/OpenApi/src/Services/OpenApiOptions.cs +++ b/src/OpenApi/src/Services/OpenApiOptions.cs @@ -29,7 +29,7 @@ public sealed class OpenApiOptions /// public OpenApiOptions() { - ShouldInclude = (description) => description.GroupName == null || description.GroupName == DocumentName; + ShouldInclude = (description) => description.GroupName == null || string.Equals(description.GroupName, DocumentName, StringComparison.OrdinalIgnoreCase); } /// diff --git a/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Services/OpenApiDocumentService/OpenApiDocumentServiceTests.Paths.cs b/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Services/OpenApiDocumentService/OpenApiDocumentServiceTests.Paths.cs index 8cf7525f7d51..adde85a2e116 100644 --- a/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Services/OpenApiDocumentService/OpenApiDocumentServiceTests.Paths.cs +++ b/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Services/OpenApiDocumentService/OpenApiDocumentServiceTests.Paths.cs @@ -3,6 +3,7 @@ using System.Net.Http; using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.OpenApi; using Microsoft.AspNetCore.Routing; public partial class OpenApiDocumentServiceTests : OpenApiDocumentServiceTestBase @@ -67,6 +68,31 @@ await VerifyOpenApiDocument(builder, document => }); } + [Fact] + public async Task GetOpenApiPaths_RespectsShouldInclude_CaseInsensitive() + { + // Arrange + var builder = CreateBuilder(); + var openApiOptions = new OpenApiOptions { DocumentName = "firstgroup" }; + + // Act + builder.MapGet("/api/todos", () => { }).WithMetadata(new EndpointGroupNameAttribute("FirstGroup")); + builder.MapGet("/api/users", () => { }).WithMetadata(new EndpointGroupNameAttribute("SecondGroup")); + + // Assert -- The default `ShouldInclude` implementation should include endpoints that + // match the document name case-insensitively. The document name is "firstgroup" (lowercase) + // but the endpoint group name is "FirstGroup" (mixed case), and it should still match. + await VerifyOpenApiDocument(builder, openApiOptions, document => + { + Assert.Collection(document.Paths.OrderBy(p => p.Key), + path => + { + Assert.Equal("/api/todos", path.Key); + } + ); + }); + } + [Fact] public async Task GetOpenApiPaths_RespectsSamePaths() {