-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add IgnoreApi() extension method for IEndpointConventionBuilder #34068
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
Comments
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. |
Swashbuckle's default logic for whether to include an API in a given OpenAPI document is based on |
Thanks for contacting us. We're moving this issue to the |
Happy to help out with implementing this one once a decided-upon API spec is ready. |
@martincostello FYI I got a prototype of this [working in my playground repo].(DamianEdwards/MinimalApiPlayground@b5f19ea) |
Thanks @DamianEdwards - I had a play around with some of the suggested API additions in the epic earlier today to try and match the API surface (but not the implementation) for hiding and also the response metadata in the repo where I've been trying stuff out: martincostello/dotnet-minimal-api-integration-testing@266fec2 |
* Support setting content types in ProducesResponseTypeAttribute to close #34542 * Add WithName extension method to resolve #34538 * Support setting endpoints on group names to resolve #34541 * Add OpenAPI extension methods to resolve #33924 * Add tests for new OpenAPI methods * Add endpoint metadata attributes * Update PublicAPI files with deltas * Add support for SuppressApi to close #34068 * Update tests to account for supporting setting content types * Fix up PublicAPI analyzer warnings * Clean up source files * Address feedback from API review * Fix typo and update type signature * Apply feedback from second API review * Update docstrings * Apply suggestions from code review Co-authored-by: Martin Costello <martin@martincostello.com> * Address non-test related feedback * Handle setting content types for ProducesResponseType attribute * Address feedback from peer review * Add test for ProducesResponseType override scenario Co-authored-by: Martin Costello <martin@martincostello.com>
Background and Motivation
Related to #34061, if using minimal hosting with minimal actions and Swashbuckle and it is possible to hide actions from API Explorer using the
[ApiExplorerSettings]
attribute (which doesn't work right now, see also #34065), it would be a quality-of-life improvement to the API surface to add an extension method forIEndpointConventionBuilder
to make it require less verbose code to hide it.Proposed API
Add a new extension method to the
Microsoft.AspNetCore.Mvc.ApiExplorer
assembly with a name something along the lines ofIgnoreApi()
:The implementation would be something like this:
Usage Examples
Alternative Designs
No alternative designs considered, this is just API sugar to remove the need to use verbose way of doing this using the existing APIs, similar to the existing
AllowAnonymous()
,RequireAuthorization()
,RequireCors()
,RequireHost()
andWithDisplayName()
extension methods:Risks
None that I'm aware of, other than potential conflicts with user-defined application extension methods of the same name.
The text was updated successfully, but these errors were encountered: