ITADN

[Bug]: No API endpoint added to the openapi document when endpoint GroupName configured

#3888ClosedWeihanLi 创建于 2026-04-13
bug
W
WeihanLicommented
### Describe the bug When I group by the endpoint into different endpoint groups and add a group name for the endpoint group `WithGroupName`, the APIs got cleared, when removed the group name configure, it works as expected sample code: ```cs #!/usr/bin/env dotnet #:sdk Microsoft.NET.Sdk.Web #:package Swashbuckle.AspNetCore@10.1.7 using Microsoft.AspNetCore.Routing.Constraints; var builder = WebApplication.CreateSlimBuilder(args); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); // include regex route constraint support // https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/2951#issuecomment-2383138868 builder.Services.Configure<RouteOptions>(options => options.SetParameterPolicy<RegexInlineRouteConstraint>("regex")); var app = builder.Build(); app.UseSwagger(); app.UseSwaggerUI(); var segmentsEndpoint = app.MapGroup("/api/segments"); segmentsEndpoint.WithGroupName("segments"); segmentsEndpoint.MapGet("/", () => Results.Ok()); await app.RunAsync(); ``` ### Expected behavior Should work as expected likes the controller/action mode ### Actual behavior No API included in the openapi document and no error/warning <img width="761" height="337" alt="Image" src="https://github.com/user-attachments/assets/e93dc132-48e7-45cb-9ad4-6893f6097a55" /> <img width="360" height="213" alt="Image" src="https://github.com/user-attachments/assets/f3127822-d701-456d-95d4-d0084d254a48" /> works when there's no GroupName configured <img width="657" height="271" alt="Image" src="https://github.com/user-attachments/assets/aed5f580-8c61-4d5f-bb48-128c278eb9cf" /> ### Steps to reproduce Add or remove the comment for `segmentsEndpoint.WithGroupName("segments");` ### Exception(s) (if any) _No response_ ### Swashbuckle.AspNetCore version 10.1.7 ### .NET Version 11.0.100-preview.2.26159.112 ### Anything else? The project is targeted at `net10.0`, and same result when using `WebApplication.CreateBuilder`
关闭于 2026-04-24 6 条评论