Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSwag.MSBuild does not support API versioning or multiple routes #1354

Open
phbarton opened this issue May 30, 2018 · 1 comment
Open

NSwag.MSBuild does not support API versioning or multiple routes #1354

phbarton opened this issue May 30, 2018 · 1 comment

Comments

@phbarton
Copy link

I am using NSwag.MSBuild 11.17.12. Additionally, I am using Microsoft.AspNetCore.Mvc.Versioning 2.2.0. If I have a controller such as:

    [Authorize]
    [ApiVersion("1.0")]
    [ApiVersion("2.0")]
    [Route("v{version:apiVersion}/mycontroller")]
    public class MyController : Controller
    {
    }

The NSwag build will only generate the swagger.json file for the first version, only. Subsequent versions do not show in the swagger file.

Also, if I try to add multiple routes to a single controller, the tool fails with an exception stating that the collection contains more than one element on a .Single() call. Example controller:

    [Authorize]
    [ApiVersion("1.0")]
    [Route("notversioned/mycontroller")]
    [Route("v{version:apiVersion}/mycontroller")]
    public class MyController : Controller
    {
    }

Expectations

  1. The generated swagger file would contain all versions/paths as specified with the [ApiVerion(...)] attributes, and
  2. The generation tool allows for multiple routes for a single controller and generates the appropriate entries in the swagger.json file.
@RicoSuter
Copy link
Owner

I think ATM the idea is to generate one spec per version.

Ref: #1288

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants