CarterCommunity / Carter

Carter is framework that is a thin layer of extension methods and functionality over ASP.NET Core allowing code to be more explicit and most importantly more enjoyable.
MIT License
2.05k stars 172 forks source link

`WithGroupName` and `WithDescription` results in that module not being surface in SwaggerUI #317

Closed tdashworth closed 1 month ago

jchannon commented 1 year ago

Must be a bug in aspnet core or in swagger ui. Carter simply calls the aspnet core OpenAPI methods

tdashworth commented 1 year ago

Just tested, it seems so 😞

RouteGroupBuilder group = app.MapGroup("/test-group");
group.WithGroupName("test_group").WithDescription("test description"); // Comment this out and it works
group.MapGet("/test", () => "Test");

FYI, I am using .NET7

Tungsten78 commented 1 year ago

Add .WithOpenApi() to the group.

jchannon commented 1 year ago

Does IncludeInOpenApi() work?

On Wed, 19 Apr 2023 at 17:58, Christopher Leigh @.***> wrote:

Add .WithOpenApi() to the group.

— Reply to this email directly, view it on GitHub https://github.com/CarterCommunity/Carter/issues/317#issuecomment-1515069571, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAZVJS7ANVD5HHJ2OS42XTXCAKSLANCNFSM6AAAAAAT37AP6M . You are receiving this because you commented.Message ID: @.***>

alexalok commented 10 months ago

@tdashworth I just spent some time figuring out the same issue. Turns out you should use WithTags("test_group") because WithGroupName actually lets you select which API definition your requests should be shown for. Since that definition defaults to the name of an entry assembly, WithGroupName("test_group") implicitly hid your requests. See https://github.com/dotnet/aspnetcore/issues/34541 for more info.

tdashworth commented 10 months ago

@alexalok Thanks so much for getting back!