title: Using Microsoft.AspNetCore.Mvc.Versioning, Swashbuckle.AspNetCore, and MaptoApiVersion
body: <p>I am having trouble with the following use of <code>MapToApiVersion</code>. From <a href="http://localhost:5000/swagger" rel="nofollow noreferrer">http://localhost:5000/swagger</a>, the 1.0 Docs and 2.0 Docs render the swagger ui properly and the corresponding swagger.json file is available. The 3.0 Docs fail to render and the swagger.json file does not appear to be generated.</p>
  
  <p>The actual service is up and running properly for all 3 versions. If I hit it from postman, I get the response I expect.</p>
  
  <p>This is running the 1.1.1-rc1 of Mvc.Versioning and 1.0.0 of Swashbuckle.AspNetCore. Full .csproj below</p>
  
  <p>Full code at <a href="https://github.com/senften/AspNetCoreVersionedWebApi/tree/maptoapiversion" rel="nofollow noreferrer">https://github.com/senften/AspNetCoreVersionedWebApi/tree/maptoapiversion</a></p>
  
  <p>I don't see any errors or have any exceptions when I run this in debug in Visual Studio Code. Have I screwed up the startup or declaration or have I simply run into a bug either in the shim or swashbuckle?</p>
  
  <pre><code>using Microsoft.AspNetCore.Mvc;
  using VersionedWebApi.Model;
  
  namespace VersionedWebApi.Controllers
  {
      /// &lt;summary&gt;
      /// GoodByeController, just saying Goodbye!
      /// &lt;/summary&gt;
      [ApiVersion("1.0", Deprecated = true)]
      [ApiVersion("3.0")]
      [Route("api/v{api-version:apiVersion}/[controller]")]
      public class GoodByeController : Controller
      {
          /// &lt;summary&gt;
          /// Default Get call returning Goodbye world!
          /// &lt;/summary&gt;
          /// &lt;returns&gt;&lt;/returns&gt;
          [HttpGet]
          [ProducesResponseType(typeof(GoodByeWorldModel), 200)]
          [ProducesResponseType(typeof(void), 404)]
          public GoodByeWorldModel Get()
          {
              return new GoodByeWorldModel();
          }
  
          /// &lt;summary&gt;
          /// Default Get call returning Goodbye world!
          /// &lt;/summary&gt;
          /// &lt;returns&gt;&lt;/returns&gt;
          [HttpGet, MapToApiVersion("3.0")]
          [ProducesResponseType(typeof(VersionedWebApi.Model.v3.GoodByeWorldModel), 200)]
          [ProducesResponseType(typeof(void), 404)]
          public VersionedWebApi.Model.v3.GoodByeWorldModel GetV3()
          {
              return new VersionedWebApi.Model.v3.GoodByeWorldModel();
          }
      }
  }
  </code></pre>
  
  <p>startup.cs</p>
  
  <pre><code>using System.Xml.XPath;
  using Microsoft.AspNetCore.Builder;
  using Microsoft.AspNetCore.Mvc;
  using Microsoft.AspNetCore.Mvc.ApplicationParts;
  using Microsoft.AspNetCore.Mvc.ApiExplorer;
  using Microsoft.Extensions.Configuration;
  using Microsoft.Extensions.DependencyInjection;
  using SwashbuckleAspNetVersioningShim;
  
  namespace VersionedWebApi
  {
      public class Startup
      {
          public Startup()
          {
          }
  
          public IConfigurationRoot Configuration { get; }
  
          // This method gets called by the runtime. Use this method to add services to the container.
          public void ConfigureServices(IServiceCollection services)
          {
              // Add framework services.
              var mvcBuilder = services.AddMvc();
              services.AddMvcCore().AddVersionedApiExplorer();
  
              // Adds versioning capabilities, defaulting to version 1.0 calls if available
              services.AddApiVersioning(o =&gt;
              {
                  o.AssumeDefaultVersionWhenUnspecified = true;
                  o.DefaultApiVersion = new ApiVersion(1, 0);
              });
  
              // Add generated documentation
              services.AddSwaggerGen(c =&gt;
              {
                  var provider = services.BuildServiceProvider().GetRequiredService&lt;IApiVersionDescriptionProvider&gt;();
                  SwaggerVersioner.ConfigureSwaggerVersions(c, provider);
              });
          }
  
          // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
          public void Configure(IApplicationBuilder app, ApplicationPartManager partManager, IApiVersionDescriptionProvider provider)
          {
              // Generate swagger.json
              app.UseSwagger();
  
              // Let's enable SwaggerUI
              app.UseSwaggerUI(c =&gt;
              {
                  SwaggerVersioner.ConfigureSwaggerVersions(c, provider);
              });
  
              app.UseMvc();
              // This is new for v1.1 and is a behavioral breaking change from previous (including 1.1-beta)
              // See the release notes: https://github.com/Microsoft/aspnet-api-versioning/releases/tag/v1.1-rc1
              app.UseApiVersioning();
          }
      }
  }
  </code></pre>
  
  <p>csproj file</p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk.Web"&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp1.1&lt;/TargetFramework&gt;
      &lt;Company /&gt;
      &lt;Description&gt;A .NET Core Web API project demonstrating versioning a Web API and generating interactive documentation with Swagger.&lt;/Description&gt;
      &lt;RepositoryUrl&gt;https://github.com/senften/AspNetCoreVersionedWebApi&lt;/RepositoryUrl&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"&gt;
      &lt;DocumentationFile&gt;&lt;/DocumentationFile&gt;
    &lt;/PropertyGroup&gt;
    &lt;ItemGroup&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="1.1.0-rc1"/&gt;
      &lt;PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" /&gt;
      &lt;PackageReference Include="SwashbuckleAspNetVersioningShim" Version="1.0.0-beta4"/&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0"/&gt;
      &lt;DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="*"/&gt;
    &lt;/ItemGroup&gt;
  
  &lt;/Project&gt;
  </code></pre>