We have two REST APIs with same name, but in different API versions. Both API have same route. Also, both APIs don't have API version in route.
API #1
[ApiVersion("V1")]
[Produces("application/json")]
[Route("application/{applicationName}")]
public class Controller : BaseClass
{
.
.
.
[HttpPost("connections/generateUri", Name = "GenerateConnectionUri")]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(ConnectionUriResponse))]
public async Task<IActionResult> GenerateConnectionUriAsync()
{
}
}
API #2
[ApiVersion("V2")]
[Produces("application/json")]
[Route("application/{applicationName}")]
public class ControllerV2 : BaseClass
{
.
.
.
[HttpPost("connections/generateUri", Name = "GenerateConnectionUriV2")]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(ConnectionUriResponseV2))]
public async Task<IActionResult> GenerateConnectionUriAsync()
{
}
}
While generating swagger.json, we are hitting a conflict for the two APIs above. It seems swagger generation is dependent upon the route, if we change the route of second API, things work properly.
How can we solve this issue to get above two APIs of same name with different API versions in swagger.json? TIA.