ApiExplorer.ApiDescriptions shows invalid routes

Topics: ASP.NET Web API, General
Mar 12 at 9:19 AM
I am working on a self-hosted web api project (.Net 4.5) where we previously only had the default route template mapped ( "api/{controller}/{id}" ). Actions deviating from this were declared with the route attribute. We are using Swashbuckle/Swagger to generate a nice API documentation, and this is based on the ApiDescriptions property on the ApiExplorer class.

So our actions look like this:
...
/api/AuthTokens/ (POST, DELETE)
/api/Customers/(id) (POST,GET,DELETE,PUT)
/api/Orders/(id) (GET)
/api/Orders/(from)/(to)/{id} (GET)
...

Yesterday I added a new route template ("api/{controller}/{from}/{to}/{id}", id optional) to the mapping, before the default route, with the purpose of serving up data for date intervals and then I removed the route attributes from the Orders actions.
This caused our Swagger docs to become all messed up, showing routes/actions that do not exist on several controllers.

It seems ApiExplorer generates ApiDescriptions for the period route for ALL controllers, even those that don't have any matching action methods. So now the documentation looks like we have these actions:
...
/api/AuthTokens/ (POST, DELETE)
/api/AuthTokens/(from)/(to) (GET) <-- no matching action method
/api/AuthTokens/(from)/(to)/(id) (GET) <-- no matching action method
/api/Customers/(id) (POST,GET,DELETE,PUT)
/api/Customers/(from)/(to) (GET) <-- no matching action method
/api/Customers/(from)/(to)/(id) (GET) <-- no matching action method
/api/Orders/(from)/(to) (GET)
/api/Orders/(from)/(to)/{id} (GET)
...

Our route mapping is quite simple:
            HttpConfiguration config = new HttpConfiguration();
            config.MapHttpAttributeRoutes();
            config.Routes.MapHttpRoute(
                name: "Period route",
                routeTemplate: "api/{controller}/{from}/{to}/{id}",
                defaults: new
                {
                    id = RouteParameter.Optional
                }, 
                constraints: new 
                {
                    from = @"^\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])$",
                    to = @"^\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])$"
                }
            );
            config.Routes.MapHttpRoute(
                name: "Default route",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
Is it the desired behavior that ApiExplorer.ApiDescriptions shows all combinations of controllers and route templates, regardless of the actions actually implemented?
If not, how do I get the ApiExplorer to only show the valid routes?