public static SwaggerEnabledConfiguration EnableSwagger( this HttpConfiguration httpConfig, string routeTemplate, Action <SwaggerDocsConfig> configure = null) { var config = new SwaggerDocsConfig(); if (configure != null) { configure(config); } httpConfig.Routes.MapHttpRoute( name: "swagger_docs", routeTemplate: routeTemplate, defaults: null, constraints: new { apiVersion = @".+" }, handler: new SwaggerDocsHandler(config) ); return(new SwaggerEnabledConfiguration( httpConfig, config.GetRootUrl, config.GetApiVersions().Select(version => routeTemplate.Replace("{apiVersion}", version)))); }
public static SwaggerEnabledConfiguration EnableSwagger(this HttpConfiguration httpConfig, string routeTemplate, Action<SwaggerDocsConfig> configure = null) { var config = new SwaggerDocsConfig(); if (configure != null) configure(config); _cnfg = config; httpConfig.Routes.MapHttpRoute( name: "swagger_docs", routeTemplate: routeTemplate, defaults: null, constraints: new { apiVersion = @".+" }, handler: new SwaggerDocsHandler(config) ); return new SwaggerEnabledConfiguration( httpConfig, config.GetRootUrl, config.GetApiVersions().Select(version => routeTemplate.Replace("{apiVersion}", version)), config); }