aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Expose ApiDescriptionProvider types and methods (so other projects can use it)

Open jkone27 opened this issue 3 years ago • 6 comments

Endpoint Metadata Parsing methods are not accessible

Many third parties might be interested in retrieving metadata from endpoints for e.g. openapi spec generation

https://github.dev/dotnet/aspnetcore/blob/94ffe0356177368d73f98021da53456fc658fcd4/src/Mvc/Mvc.ApiExplorer/src/EndpointMetadataApiDescriptionProvider.cs#L28

Describe the solution you'd like

It would be appreciated if metadata from endpoint could be easilly navigated and extracted (e.g. Expression<T> of invoked lambda/delegate, main properties of lambda/delegate, return type, parameters type, HTTP method name, etc....)

that way endpoints could be inspected at runtime just checking

IEnumerable<EndpointDataSource>

but right now it's hard and very tough to do especially for NON MVC projects (even requires quite elaborated reflection to access endpoint info...)

Additional context

https://github.com/pimbrouwers/Falco/issues/49 https://github.com/giraffe-fsharp/Giraffe/issues/488#issuecomment-884217398 https://github.com/giraffe-fsharp/Giraffe/issues/428 https://github.com/giraffe-fsharp/Giraffe/issues/488 https://github.com/SaturnFramework/Saturn/issues/30

jkone27 avatar Jan 12 '22 13:01 jkone27

Thanks for contacting us.

We're moving this issue to the .NET 7 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.

ghost avatar Jan 13 '22 19:01 ghost

Similar issue: https://github.com/dotnet/aspnetcore/issues/33644

rafikiassumani-msft avatar Jan 13 '22 19:01 rafikiassumani-msft

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.

ghost avatar Jun 14 '22 22:06 ghost

Any updates on this for 2024 NET9 release? cc @captainsafia , thanks for tracking this

jkone27 avatar Oct 11 '24 11:10 jkone27

@jkone27 Hey -- sorry I hadn't seen this issue before. 😅

With regard to solving the issues that you referenced in the original bug report, does the guidance that I recommended in https://github.com/giraffe-fsharp/Giraffe/issues/488#issuecomment-2091220245?

If so, it would be good to get a sense of what specific APIs need to be consumed. How is making EndpointMetadataApIDescriptionProvider public different from the current situation of being able to consume it's outputs via the public ApiDescription types?

captainsafia avatar Oct 11 '24 16:10 captainsafia

I see in Oxpecker and Falco the maintainers managed to implement something for openapi descriptors, they are both F# FP wrappers on top of AspNet core, some discussions there I can link them here if u are interested, sorry for the late reply

jkone27 avatar Oct 15 '24 16:10 jkone27