-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
What is the recommended mechanism to ignore actions from Swagger with minimal actions? #34061
Comments
It's possible that using I've opened #34065 as a draft that resolves that, assuming it's the correct thing to do. |
Populate the EndpointMetadata property of the ActionDescriptor on ActionDescriptor instances for minimal actions so that the attributes associated with the request delegate can be inspected. Relates to dotnet#34061.
Having dug through how this works today for MVC, it looks like this is currently dealt with by
The model doesn't support having multiple models either from what I can tell, so it doesn't look like having a parallel implementation that didn't care about controllers and operated in the registered endpoints would make much sense either. TL;DR - It looks like #34065 wouldn't make |
Thanks for contacting us. We're moving this issue to the |
* Populate ActionDescriptor EndpointMetadata Populate the EndpointMetadata property of the ActionDescriptor on ActionDescriptor instances for minimal actions so that the attributes associated with the request delegate can be inspected. Relates to #34061. * Simplify metadata assignment Remove filtering and just directly populate the list. Fix typo in comment.
Resolved by #34906. |
I've been playing around with using minimal actions to build a sample app that's a mix of API, Identity and Razor Pages, but exclusively using minimal actions to implement any endpoints in the app, not just the API. I'm currently using this with a daily build of the preview 7 SDK (
6.0.100-preview.7.21330.1
).When plugging-in Swagger with the minimal configuration, all the minimal actions endpoints are returned in the Swagger documentation.
I've manually hidden things with the following code:
However what I would have liked to have done instead is to explicitly hide the actions using the
ApiExplorerSettings
attribute using the new support for attributes on lambdas, that doesn't seem to be working.This is what I tried:
Another approach I've used in the past is the
IActionModelConvention
support, but that's part of MVC so doesn't appear to be valid either.While the
DocInclusionPredicate()
approach works with a simple app, it doesn't feel like it would scale well from a maintenance point of view, particularly if the naming/paths weren't following a specific convention. It also doesn't seem possible to query for any decorated attributes (i.e. theApiExplorerSettingsAttribute
) from theApiDescription
passed to the method.What is/will be the intended mechanism developers using minimal actions would use to hide specific actions from the API Explorer for use cases like Swagger?
The text was updated successfully, but these errors were encountered: