Ejemplo n.º 1
0
        public void EnableSwaggerUi(
            string routeTemplate,
            Action <SwaggerUiConfig> configure = null)
        {
            var config = new SwaggerUiConfig(_discoveryPaths, _rootUrlResolver);

            if (configure != null)
            {
                configure(config);
            }

            _httpConfig.Routes.MapHttpRoute(
                name: "swagger_ui",
                routeTemplate: routeTemplate,
                defaults: null,
                constraints: new { assetPath = @".+" },
                handler: new SwaggerUiHandler(config)
                );

            if (routeTemplate == DefaultRouteTemplate)
            {
                _httpConfig.Routes.MapHttpRoute(
                    name: "swagger_ui_shortcut",
                    routeTemplate: "swagger",
                    defaults: null,
                    constraints: null,
                    handler: new RedirectHandler(_rootUrlResolver, "swagger/ui/index"));
            }
        }
Ejemplo n.º 2
0
 public SwaggerUiHandler(SwaggerUiConfig config)
 {
     _config = config;
 }
Ejemplo n.º 3
0
 public SwaggerUiHandler(SwaggerUiConfig config)
 {
     _config = config;
 }