dotnet/aspnetcore

Add support for setting ApiDescriptor.GroupName for minimal APIs

DamianEdwards opened this issue · 4 comments

Minimal APIs currently don't populate any value for the ApiDescriptor.GroupName property. We should add support for setting the group name via endpoint metadata and flowing that through to the ApiDescriptor, e.g.:

app.MapGet("/myapi/do-the-thing", () => "done!")
   .WithGroupName("v1");

// Psuedo-spec
public static IEndpointConventionBuilder WithGroupName(this IEndpointConventionBuilder builder, string groupName)
{
    builder.WithMetadata(new EndpointGroupNameMetadata(groupName));
}

// Attribute for declarative scenario
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate, Inherited = false, AllowMultiple = false)]
public sealed class EndpointGroupNameAttribute: Attribute, IEndpointGroupNameMetadata;

Setting it by default
Swashbuckle currently uses ApiDescriptor.GroupName in its default API inclusion predicate in such a way that if we were to set a default value that doesn't match the configured Swagger document name, the APIs would not be included by default. For that reason it seems like we shouldn't set a default value for ApiDescriptor.GroupName unless we also update the Swashbuckle logic.

@bradygaster

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@DamianEdwards I'm interested in doing this issue. Is it up for grab?

Thanks for contacting us.

We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

Closing in favor of #34541.