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

Empty API documentation using {version} in HttpRoute #303

Closed
aviadavi opened this issue Apr 28, 2015 · 1 comment
Closed

Empty API documentation using {version} in HttpRoute #303

aviadavi opened this issue Apr 28, 2015 · 1 comment

Comments

@aviadavi
Copy link

Hi,

My WebAPI.Config file looks like that :

    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "v{version}/{controller}/{id}/{controller2}/{id2}",

when I build my application, and going to /swagger the list of controllers are empty.

when I remove the "v{version}/" at the routeTemplate, i can see all controllers and API documentation is generated

Any idea how to work with "{version} ?

@domaindrivendev
Copy link
Owner

Have a read through #51 and #144 as I believe you're likely experiencing the same issue.

If you don't want to read though them all - here's the summary ...

I'm assuming you've created your own version of IHttpControllerSelector to support controller selection based on the "version" route parameter? Depending on the implementation, this is most likely breaking WebApi's built-in metadata layer - "ApiExplorer" and subsequently Swashbuckle.

This is one of the reasons why the WebApi team recommend using attribute routing over a custom IHttpControllerSelector to implement versioning:

http://blogs.msdn.com/b/webdev/archive/2014/08/22/customizing-web-api-controller-selector.aspx

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

No branches or pull requests

2 participants