title: asp.net core swashbuckle how to use versioning in same controller
body: <p>When using versioning in asp.net core with swashbuckle for swagger, you cannot have by default multiple methods in same controller like that:</p>
  <pre><code>[Route(&quot;v{version:apiVersion}/[controller]&quot;)]
  [ApiVersion(&quot;1&quot;)]
  [ApiVersion(&quot;2&quot;)]
  [ApiController]
  public class TestController : ControllerBase
  {
      /// &lt;summary&gt;
      /// test ver 1
      /// &lt;/summary&gt;
      /// &lt;returns&gt;&lt;/returns&gt;
      [HttpGet]
      [MapToApiVersion(&quot;1&quot;)]
      [ProducesResponseType(StatusCodes.Status200OK)]
      public string Get()
      {
          return &quot;Version 1&quot;;
      }
  
      /// &lt;summary&gt;
      /// test ver 2
      /// &lt;/summary&gt;
      /// &lt;returns&gt;&lt;/returns&gt;
      [HttpGet]
      [MapToApiVersion(&quot;2&quot;)]
      [ProducesResponseType(StatusCodes.Status200OK)]
      public string Get2()
      {
          return &quot;Version 2&quot;;
      }
  }
  </code></pre>
  <p>By default, you will have error message</p>
  <blockquote>
  <p>Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException:
  Conflicting method/path combination &quot;GET v{version}/Test&quot; for actions</p>
  <ul>
  <li>...Controllers.TestController.Get,...TestController.Get2</li>
  </ul>
  </blockquote>
  <p>because swagger-ui recognized both methods by same route</p>
  <blockquote>
  <p>localhost/v{version:apiVersion}/Test</p>
  </blockquote>
  <p>Basic swashbuckle solution is to have two separate controllers for each version of method. That is bad solution for my use-case.</p>