Reputation: 123
I am using Swashbuckle Swagger for API documentation and I have controller with 4 endpoints, 3 of which share the same name (but have different parameters) and Swagger does not display them. I can not change names for these methods, nor do I want to resolve conflicts and take only the first one. I want to display them all on Swagger UI but I don't know how.
I tried implementing other workarounds like specifiying Route annotations etc. but it didn't work.
Methods are like this:
public IHttpActionResult Get([FromUri] int[] myId, [FromUri] int[] otherId, DateTime fromDate, DateTime toDate, bool allEntities = false)
public IHttpActionResult Get([FromUri] int[] myId, DateTime fromDate, bool allEntities = false)
public IHttpActionResult Get([FromUri] int[] myId, [FromUri] int[] otherId, DateTime date, string someOtherId = null, bool allEntities = false, string lan = "en")
Desired result is to show all of these methods on SwaggerUI and not only the first one. Is there any way to do this?
Upvotes: 1
Views: 1476
Reputation: 917
Unfortunately, Swagger won't allow this. I don't know what each method's content looks like, but you could consider combining the three into one method that accepts a combination of all params from the three and then, based on the params received, do the logic in whichever existing method that makes the most sense (I would assume you would keep that logic around in private methods). Sorry for the bad news!
Upvotes: 2