Skip to content

Add support for setting ApiDescriptor.GroupName for minimal APIs #34443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #34514
DamianEdwards opened this issue Jul 16, 2021 · 4 comments
Closed
Tracked by #34514

Add support for setting ApiDescriptor.GroupName for minimal APIs #34443

DamianEdwards opened this issue Jul 16, 2021 · 4 comments
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-minimal-actions Controller-like actions for endpoint routing Priority:1 Work that is critical for the release, but we could probably ship without
Milestone

Comments

@DamianEdwards
Copy link
Member

DamianEdwards commented Jul 16, 2021

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

@DamianEdwards DamianEdwards added feature-minimal-actions Controller-like actions for endpoint routing area-runtime api-suggestion Early API idea and discussion, it is NOT ready for implementation labels Jul 16, 2021
@DamianEdwards DamianEdwards changed the title Minimal APIs should populate ApiDescriptor.GroupName Add support for setting ApiDescriptor.GroupName for minimal APIs Jul 17, 2021
@rafikiassumani-msft rafikiassumani-msft added this to the Backlog milestone Jul 19, 2021
@ghost
Copy link

ghost commented Jul 19, 2021

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.

@Kahbazi
Copy link
Member

Kahbazi commented Jul 20, 2021

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

@ghost
Copy link

ghost commented Jul 20, 2021

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.

@rafikiassumani-msft rafikiassumani-msft added the Priority:1 Work that is critical for the release, but we could probably ship without label Jul 22, 2021
@captainsafia
Copy link
Member

Closing in favor of #34541.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 28, 2021
@amcasey amcasey added area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc and removed area-runtime labels Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-minimal-actions Controller-like actions for endpoint routing Priority:1 Work that is critical for the release, but we could probably ship without
Projects
None yet
Development

No branches or pull requests

5 participants