Swagger.Net icon indicating copy to clipboard operation
Swagger.Net copied to clipboard

Support AttributeRouting

Open jamesholcomb opened this issue 11 years ago • 3 comments

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.

jamesholcomb avatar Jan 16 '13 21:01 jamesholcomb