Exemple #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, CheckoutDbContext context)
        {
            if (!context.Database.IsInMemory())
            {
                context.Database.Migrate();
            }

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseAuthentication();

            var swaggerSettings = new SwaggerSettings();

            Configuration.Bind(nameof(SwaggerSettings), swaggerSettings);

            app.UseSwagger(options => options.RouteTemplate = swaggerSettings.JsonRoute);
            app.UseSwaggerUI(options =>
            {
                options.SwaggerEndpoint(swaggerSettings.UIEndpoint, swaggerSettings.Description);
            });

            app.UseMvc();
        }
Exemple #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            services.AddSingleton <ICurrencySymbolsExRatesApiHelper, CurrencySymbolsExRatesApiHelper>();
            services.AddHttpClient <IExchangeRatesService, ExchangeRatesService>(client =>
            {
                client.BaseAddress = new Uri(Configuration.GetValue <string>("ExchangeAPIs:ExchangeratesApi:BaseUrl"));
            });

            services.AddHttpClient <IApiExchangeRateService, ApiExchangeRateService>(client =>
            {
                client.BaseAddress = new Uri(Configuration.GetValue <string>("ExchangeAPIs:Api.Exchangerate:BaseUrl"));
                //client.DefaultRequestHeaders.Add("Accept","application/json;");
            });

            var swaggerSettings = new SwaggerSettings();

            Configuration.GetSection(nameof(SwaggerSettings)).Bind(swaggerSettings);
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo
                {
                    Version     = "v1",
                    Title       = swaggerSettings.Title,
                    Description = swaggerSettings.Description,
                    //Contact = new OpenApiContact
                    //{
                    //    Name = swaggerSettings.ContactName,
                    //    Email = string.Empty,
                    //    Url = new Uri(swaggerSettings.ContactUrl)
                    //}
                });
            });
        }
Exemple #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseAuthentication();

            app.UseHttpsRedirection();
            app.UseMvc();

            var swaggerSettings = new SwaggerSettings();

            Configuration.GetSection(nameof(SwaggerSettings)).Bind(swaggerSettings);


            app.UseSwagger(option =>
            {
                option.RouteTemplate = swaggerSettings.JsonRoute;
            });


            app.UseSwaggerUI(option =>
            {
                option.SwaggerEndpoint(swaggerSettings.UIEndpoint, swaggerSettings.Description);
            });
        }
Exemple #4
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var swaggerSettings = new SwaggerSettings().Bind(Configuration);

            app.UseSwagger(option => { option.RouteTemplate = swaggerSettings.JsonRoute; });
            app.UseSwaggerUI(option =>
            {
                option.SwaggerEndpoint(swaggerSettings.UIEndpoint, swaggerSettings.Description);
            });

            app.UseHttpsRedirection();
            app.UseCors(_corsPolicy);

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Exemple #5
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            // global cors policy
            app.UseCors(x => x
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .AllowCredentials());

            app.UseStatusCodePages();
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseAuthentication();
            app.UseMiddleware(typeof(ErrorHandlingMiddleware));

            // Swagger configuration
            var swaggerSettings = new SwaggerSettings();

            Configuration.GetSection(nameof(SwaggerSettings)).Bind(swaggerSettings);
            app.UseSwagger(option => { option.RouteTemplate = swaggerSettings.JsonRoute; });
            app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerSettings.UIEndpoint, swaggerSettings.Description); });


            app.UseMvc();
        }
Exemple #6
0
        public void InstallServices(IServiceCollection services, IConfiguration configuration)
        {
            services.AddControllers();
            var swaggerSettings = new SwaggerSettings();

            configuration.GetSection(nameof(SwaggerSettings)).Bind(swaggerSettings);
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("V1", new OpenApiInfo
                {
                    Title   = "MarketIO",
                    Version = "V1"
                });
                c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
                {
                    In          = ParameterLocation.Header,
                    Description = "Please insert JWT with Bearer into field",
                    Name        = "Authorization",
                    Type        = SecuritySchemeType.ApiKey
                });
                c.AddSecurityRequirement(new OpenApiSecurityRequirement {
                    {
                        new OpenApiSecurityScheme
                        {
                            Reference = new OpenApiReference
                            {
                                Type = ReferenceType.SecurityScheme,
                                Id   = "Bearer"
                            }
                        },
                        new string[] { }
                    }
                });
            });
        }
        public static IServiceCollection AddSwaggerOpenApi(this IServiceCollection services, IConfiguration configuration)
        {
            var swaggerSettings = new SwaggerSettings();

            configuration.Bind(nameof(SwaggerSettings), swaggerSettings);
            services.AddSingleton(swaggerSettings);
            var apiSettings = new TheGameSettings();

            configuration.Bind(nameof(TheGameSettings), apiSettings);

            services.AddSwaggerGen(options => {
                options.SwaggerDoc(apiSettings.CurrentVersion, new OpenApiInfo()
                {
                    Title = apiSettings.Title, Version = apiSettings.CurrentVersion
                });
                options.ExampleFilters();

                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                options.IncludeXmlComments(xmlPath);
            });

            services.AddSwaggerExamplesFromAssemblyOf <Startup>();

            return(services);
        }
Exemple #8
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var swaggerOptions = new SwaggerSettings();

            Configuration.GetSection(nameof(SwaggerSettings)).Bind(swaggerOptions);

            app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; });
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.Description);
            });
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseRouting();
            app.UseCors(MyAllowSpecificOrigins);
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Exemple #9
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                SwaggerSettings swaggerConf = new SwaggerSettings(Configuration);
                c.SwaggerEndpoint(swaggerConf.Swagger.EndPoint, swaggerConf.Swagger.Spec);
                //c.RoutePrefix = string.Empty;
            });

            app.UseHttpsRedirection();

            app.UseAuthentication();

            //app.UseMvc();
            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action}");
                routes.MapSpaFallbackRoute("spa-fallback", new { controller = "Blog", action = "Index" });
            });
        }
Exemple #10
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            UpdateDatabase(app);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            var swaggerSettings = new SwaggerSettings();

            Configuration.GetSection(nameof(SwaggerSettings)).Bind(swaggerSettings);

            app.UseSwagger(option => { option.RouteTemplate = swaggerSettings.JsonRoute; });

            app.UseSwaggerUI(option =>
            {
                option.SwaggerEndpoint(swaggerSettings.UiEndpoint, swaggerSettings.Description);
            });

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Exemple #11
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVersionDescriptionProvider provider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            var swaggerSettings = new SwaggerSettings();

            Configuration.Bind(nameof(SwaggerSettings), swaggerSettings);

            app.UseSwagger(sw => sw.RouteTemplate = swaggerSettings.JsonRoute);
            app.UseSwaggerUI(sw =>
            {
                foreach (var description in provider.ApiVersionDescriptions)
                {
                    sw.RoutePrefix = "";
                    sw.SwaggerEndpoint($"/{description.GroupName}/swagger.json",
                                       description.GroupName.ToUpperInvariant());
                }
            });

            app.UseMiddleware <ExceptionMiddleware>();

            app.UseEndpoints(endpoints =>
                             endpoints.MapControllers());
        }
Exemple #12
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseRouting();
            app.UseCors();

            app.UseAuthentication();
            app.UseAuthorization();

            var swaggerSettings = new SwaggerSettings();

            Configuration.GetSection(nameof(swaggerSettings)).Bind(swaggerSettings);

            app.UseSwagger(options => {
                options.RouteTemplate = swaggerSettings.JsonRoute;
            });

            app.UseSwaggerUI(options => {
                options.SwaggerEndpoint(swaggerSettings.UIEndpoint, swaggerSettings.Description);
            });


            app.UseEndpoints(endpoints => {
                endpoints.MapControllers();
            });
        }
Exemple #13
0
 /// <summary>Initializes a new instance of the <see cref="OpenApiDocumentMiddleware"/> class.</summary>
 /// <param name="next">The next middleware.</param>
 /// <param name="path">The path.</param>
 /// <param name="controllerTypes">The controller types.</param>
 /// <param name="settings">The settings.</param>
 public OpenApiDocumentMiddleware(OwinMiddleware next, string path, IEnumerable <Type> controllerTypes, SwaggerSettings <WebApiOpenApiDocumentGeneratorSettings> settings)
     : base(next)
 {
     _path            = path;
     _controllerTypes = controllerTypes;
     _settings        = settings;
 }
Exemple #14
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            var swaggerSettings = new SwaggerSettings();

            Configuration.GetSection(nameof(swaggerSettings)).Bind(swaggerSettings);

            _apiStartup.AddSwaggerUi(app, swaggerSettings.URL, swaggerSettings.Name);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseCors("AuthCorsConfig");

            app.UseMvc();

            //app.UseEndpoints(endpoints =>
            //{
            //    endpoints.MapControllers();
            //});
        }
Exemple #15
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseCors("DevelopmentCorsPolicy");
                app.UseDeveloperExceptionPage();
            }

            // Swagger setup
            SwaggerSettings swaggerSettings = new SwaggerSettings();

            this.Configuration.GetSection(nameof(SwaggerSettings)).Bind(swaggerSettings);
            app.UseSwagger(settings => settings.RouteTemplate = swaggerSettings.JsonRoute);
            app.UseSwaggerUI(settings => settings.SwaggerEndpoint(swaggerSettings.UIEndpoint, swaggerSettings.Description));

            // app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
        public void InstallServices(IServiceCollection services, IConfiguration configuration)
        {
            var swaggerSettings = new SwaggerSettings();

            configuration.GetSection(nameof(SwaggerSettings)).Bind(swaggerSettings);
            services.AddSwaggerGen(settings => {
                var security       = new  OpenApiSecurityRequirement();
                var securityScheme = new OpenApiSecurityScheme()
                {
                    Description = "Using Bearer Authorization",
                    Name        = "Authorization",
                    In          = ParameterLocation.Header,
                    Type        = SecuritySchemeType.ApiKey
                };
                security.Add(securityScheme, new List <string>()
                {
                });
                settings.SwaggerDoc("V1", new Microsoft.OpenApi.Models.OpenApiInfo()
                {
                    Description = swaggerSettings.Description,
                    Version     = "V1",
                    Title       = "MarketIO"
                });
                settings.AddSecurityDefinition("Bearer", securityScheme);
                settings.AddSecurityRequirement(security);
            });
            services.AddControllers();
        }
 /// <summary>Addes the Swagger generator to the OWIN pipeline.</summary>
 /// <param name="app">The app.</param>
 /// <param name="controllerTypes">The Web API controller types.</param>
 /// <param name="settings">The Swagger generator settings.</param>
 /// <returns>The app builder.</returns>
 public static IAppBuilder UseSwagger(
     this IAppBuilder app,
     IEnumerable <Type> controllerTypes,
     SwaggerSettings settings)
 {
     return(app.UseSwagger(controllerTypes, settings, new SwaggerJsonSchemaGenerator(settings)));
 }
Exemple #18
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();
            app.UseCors("EnableCors");
            app.UseRouting();
            app.UseAuthorization();
            app.UseAuthorization();
            var swaggerSettings = new SwaggerSettings();

            Configuration.GetSection(nameof(SwaggerSettings)).Bind(swaggerSettings);
            app.UseSwagger(options =>
            {
                options.RouteTemplate = swaggerSettings.JsonRoute;
            });

            app.UseSwaggerUI(options =>
            {
                options.SwaggerEndpoint(swaggerSettings.UIEndPoint, swaggerSettings.Description);

                options.DocumentTitle = "MarketIO";
                options.DocExpansion(DocExpansion.None);
            });
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Exemple #19
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                SwaggerSettings swaggerConf = new SwaggerSettings(Configuration);
                c.SwaggerEndpoint(swaggerConf.Swagger.EndPoint, swaggerConf.Swagger.Spec);
                //c.RoutePrefix = string.Empty;
            });

            //app.UseMvc();
            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute("api/get", async context =>
                {
                    await context.Response.WriteAsync("для обработки использован маршрут api/get");
                });

                routes.MapRoute(
                    name: "DefaultApi",
                    template: "{controller}/{action}");
                routes.MapSpaFallbackRoute("spa-fallback", new { controller = "Blog", action = "Index" });
            });
        }
 /// <summary>Addes the Swagger generator and Swagger UI to the OWIN pipeline.</summary>
 /// <param name="app">The app.</param>
 /// <param name="webApiAssembly">The Web API assembly to search for controller types.</param>
 /// <param name="settings">The Swagger generator settings.</param>
 /// <returns>The app builder.</returns>
 public static IAppBuilder UseSwagger(
     this IAppBuilder app,
     Assembly webApiAssembly,
     SwaggerSettings settings)
 {
     return(app.UseSwagger(new[] { webApiAssembly }, settings));
 }
Exemple #21
0
        public static SwaggerSettings <T> ConfigureNames <T>(this SwaggerSettings <T> settings) where T : SwaggerGeneratorSettings, new()
        {
            settings.GeneratorSettings.Title   = "Squidex API";
            settings.GeneratorSettings.Version = "1.0";

            return(settings);
        }
Exemple #22
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <DataContext>(opt => opt.UseNpgsql(Configuration.GetConnectionString("NewsPortalDbConnectionString")));

            services.AddMvc();

            SwaggerSettings swaggerConf = new SwaggerSettings(Configuration);

            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc(swaggerConf.Swagger.Version, new Info
                {
                    Version     = swaggerConf.Swagger.Version,
                    Title       = swaggerConf.Swagger.Title,
                    Description = swaggerConf.Swagger.Description
                });
                c.IncludeXmlComments(string.Format(@"{0}\{1}", AppDomain.CurrentDomain.BaseDirectory, swaggerConf.Swagger.AppComments));
            });

            services.AddScoped <INewsRepository, NewsRepository>();

            services.AddScoped <INewsStorage, NewsStorage>();

            services.AddScoped <NewsBuilder>();

            services.AddAutoMapper(typeof(MappingProfile));
        }
Exemple #23
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            serviceProvider.GetService <ApplicationDbContext>().Database.EnsureCreated();

            app.UseSwagger();

            app.UseAuthentication();

            SwaggerSettings swaggerOptions = new SwaggerSettings();

            Configuration.GetSection(nameof(SwaggerSettings)).Bind(swaggerOptions);
            app.UseSwaggerUI(config =>
            {
                config.SwaggerEndpoint(swaggerOptions.EndPoint, swaggerOptions.Name);
            });

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Exemple #24
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var swaggerOptions = new SwaggerSettings();

            Configuration.GetSection(nameof(SwaggerSettings)).Bind(swaggerOptions);
            app.UseSwagger();
            app.UseSwaggerUI(option =>
            {
                option.SwaggerEndpoint(swaggerOptions.JsonRoute, swaggerOptions.Description);
            });

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();
            app.UseCors(c => c.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller}/{action=Index}/{id?}");
                endpoints.MapControllers();
            });
        }
Exemple #25
0
        /// <inheritdoc />
        public ConfigureSwaggerUIOptions(IApiVersionDescriptionProvider versionDescriptionProvider, IOptions <SwaggerSettings> settings)
        {
            Debug.Assert(versionDescriptionProvider != null, $"{nameof(versionDescriptionProvider)} != null");
            Debug.Assert(settings != null, $"{nameof(versionDescriptionProvider)} != null");

            this.provider = versionDescriptionProvider;
            this.settings = settings?.Value ?? new SwaggerSettings();
        }
Exemple #26
0
 /// <summary>Initializes a new instance of the <see cref="SwaggerMiddleware"/> class.</summary>
 /// <param name="nextDelegate">The next delegate.</param>
 /// <param name="path">The path.</param>
 /// <param name="controllerTypes">The controller types.</param>
 /// <param name="settings">The settings.</param>
 /// <param name="schemaGenerator">The schema generator.</param>
 public SwaggerMiddleware(RequestDelegate nextDelegate, string path, IEnumerable <Type> controllerTypes, SwaggerSettings settings, SwaggerJsonSchemaGenerator schemaGenerator)
 {
     _nextDelegate    = nextDelegate;
     _path            = path;
     _controllerTypes = controllerTypes;
     _settings        = settings;
     _schemaGenerator = schemaGenerator;
 }
Exemple #27
0
 /// <summary>Initializes a new instance of the <see cref="WebApiToSwaggerMiddleware"/> class.</summary>
 /// <param name="nextDelegate">The next delegate.</param>
 /// <param name="apiDescriptionGroupCollectionProvider">The <see cref="IApiDescriptionGroupCollectionProvider"/>.</param>
 /// <param name="settings">The settings.</param>
 /// <param name="schemaGenerator">The schema generator.</param>
 public AspNetCoreToSwaggerMiddleware(RequestDelegate nextDelegate, IApiDescriptionGroupCollectionProvider apiDescriptionGroupCollectionProvider, SwaggerSettings <AspNetCoreToSwaggerGeneratorSettings> settings, SwaggerJsonSchemaGenerator schemaGenerator)
 {
     _nextDelegate    = nextDelegate;
     _settings        = settings;
     _path            = settings.ActualSwaggerRoute;
     _schemaGenerator = schemaGenerator;
     _apiDescriptionGroupCollectionProvider = apiDescriptionGroupCollectionProvider;
 }
Exemple #28
0
        private static SwaggerSettings ConfigureIdentity(this SwaggerSettings settings, MyUrlsOptions urlOptions)
        {
            settings.DocumentProcessors.Add(new SecurityDefinitionAppender(Constants.SecurityDefinition, SwaggerHelper.CreateOAuthSchema(urlOptions)));

            settings.OperationProcessors.Add(new ScopesProcessor());

            return(settings);
        }
 /// <summary>Initializes a new instance of the <see cref="SwaggerMiddleware"/> class.</summary>
 /// <param name="next">The next middleware.</param>
 /// <param name="path">The path.</param>
 /// <param name="controllerTypes">The controller types.</param>
 /// <param name="settings">The settings.</param>
 /// <param name="schemaGenerator">The schema generator.</param>
 public SwaggerMiddleware(OwinMiddleware next, string path, IEnumerable <Type> controllerTypes, SwaggerSettings settings, SwaggerJsonSchemaGenerator schemaGenerator)
     : base(next)
 {
     _path            = path;
     _controllerTypes = controllerTypes;
     _settings        = settings;
     _schemaGenerator = schemaGenerator;
 }
Exemple #30
0
 /// <summary>Addes the Swagger generator and Swagger UI to the OWIN pipeline.</summary>
 /// <param name="app">The app.</param>
 /// <param name="webApiAssemblies">The Web API assemblies to search for controller types.</param>
 /// <param name="settings">The Swagger generator settings.</param>
 /// <returns>The app builder.</returns>
 public static IAppBuilder UseSwagger(
     this IAppBuilder app,
     IEnumerable<Assembly> webApiAssemblies,
     SwaggerSettings settings)
 {
     var controllerTypes = webApiAssemblies.SelectMany(WebApiToSwaggerGenerator.GetControllerClasses);
     return app.UseSwagger(controllerTypes, settings);
 }