Swagger.Net
Swagger.Net copied to clipboard
Support AttributeRouting
Trying to get your included sample to work with AR by adding these to the BlogPostsController
[RoutePrefix("api/BlogPosts")]
[DefaultHttpRouteConvention]
and using the following AR routing setup
public static void RegisterRoutes(HttpRouteCollection routes) {
// See http://github.com/mccalltd/AttributeRouting/wiki for more options.
// To debug routes locally using the built in ASP.NET development server, go to /routes.axd
routes.MapHttpAttributeRoutes(config =>
{
config.AutoGenerateRouteNames = true;
config.UseLowercaseRoutes = true;
config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
config.RouteNameBuilder = RouteNameBuilders.Unique;
}
);
}
But only the GET endpoint shows up in the Swagger UI. If you check /routes.axd, you can see the list of route names and urls.
Hey James.
Sorry for delay. I'll try to look at this tonight but FYI, attribute routing can be really slow. Then team I'm working with had to ditch it for performance reasons. But the have 30 or 40 controllers and it might be fixed in latest release.
Thx. Dan
Sent from my iPad
On Jan 16, 2013, at 4:27 PM, James Holcomb [email protected] wrote:
Trying to get your included sample to work with AR by adding these to the BlogPostsController
[RoutePrefix("api/BlogPosts")] [DefaultHttpRouteConvention]
and using the following AR routing setup
public static void RegisterRoutes(HttpRouteCollection routes) { // See http://github.com/mccalltd/AttributeRouting/wiki for more options. // To debug routes locally using the built in ASP.NET development server, go to /routes.axd
routes.MapHttpAttributeRoutes(config =>
{
config.AutoGenerateRouteNames = true;
config.UseLowercaseRoutes = true;
config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
config.RouteNameBuilder = RouteNameBuilders.Unique;
}
);
}
But only the GET endpoint shows up in the Swagger UI. If you check /routes.axd, you can see the list of route names and urls.
— Reply to this email directly or view it on GitHubhttps://github.com/danieleli/Swagger.Net/issues/2.
Any progress? I don't have any performance issues with AR. I have 10 controllers.
Hey, I'm wrapping up some OAuth stuff today but I'm back on this full time for my project after that. So I should have something for ya by EOD tomorrow.