The same method and the same route are used for two different endpoints: one is a GET, the other one is a POST. Is there a way to hide only one of them (e.g. just the GET one) from the Swagger UI?
[Route("myroute")]
[HttpPost]
[HttpGet] // This is being keep for compatibility purposes (legacy services that are still using it)
I tried using the IgnoreApi property (see below) with no luck: it hides both the GET and the POST. Seems like it hides the entire route, no matter the HTTP method.
[ApiExplorerSettings(IgnoreApi = false)]
Not on the same endpoint. The ApiExplorerSettings
Attribute is for the entire method and cannot be applied to a specific Attribute accompanying the method.
What you can do is the following:
[HttpPost]
public void MyCurrentMethod() {
//Do stuff...
}
[ApiExplorerSettings(IgnoreApi = true)]
[HttpGet]
public void MyDepricatedMethod() => MyCurrentMethod();