Reputation: 4161
I'm trying to create documentation for my API's. So far I've tried with Swagger.Net and Web API help pages
Both tools provided me with correct documentation which is generated from XML but both of them showed me duplicate entries. I'm supposing that's related how my routes are configured:
config.Routes.MapHttpRoute(
name: "Sample1",
routeTemplate: "sample1/{controller}/{id}",
defaults: new { id = RouteParameter.Optional });
config.Routes.MapHttpRoute(
name: "Sample2",
routeTemplate: "sample2/{controller}/{id}",
defaults: new { id = RouteParameter.Optional });
What I see in view is methods both from Sample1 and Sample2, something like this:
../sample1/method1
../sample1/method2
../sample2/method1
../sample2/method2
And I want this:
../sample1/method1
../sample2/method2
Any ideas?
Upvotes: 1
Views: 2253
Reputation: 57939
Based on your last comment, you could do this by setting route constraints and expect HelpPage to show up correctly. Example below:
config.Routes.MapHttpRoute(
name: "AdminRoute",
routeTemplate: "api/folder1/{controller}/{id}",
defaults: new { id = RouteParameter.Optional },
constraints: new { controller = "Roles|Users" }
);
config.Routes.MapHttpRoute(
name: "RegularRoute",
routeTemplate: "api/folder2/{controller}/{id}",
defaults: new { id = RouteParameter.Optional },
constraints: new { controller = "Products|Reviews" }
);
NOTE: if you try to make folder to be route variable, then HelpPage will not be able to show up the help documentation.
Upvotes: 2