// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseMiddleware <ErrorHandlingMiddleware>(); var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(options => options.RouteTemplate = swaggerOptions.JsonRoute); app.UseSwaggerUI(options => options.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.ApiDescription)); var jwtOptions = new JwtOptions(); Configuration.GetSection(nameof(JwtOptions)).Bind(jwtOptions); app.UseRouting(); app.UseCors( options => options.WithOrigins("http://localhost:3000") .AllowAnyMethod() .AllowAnyHeader() ); app.UseAuthentication(); app.UseAuthorization(); app.UseHangfireDashboard(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapHangfireDashboard(); }); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { var options = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(options); app.UseSwagger(c => { c.RouteTemplate = options.JsonRoute; }); app.UseSwaggerUI(c => { c.SwaggerEndpoint(options.UiEndpoint, options.Description); c.RoutePrefix = string.Empty; }); app.ConfigureExceptionHandler(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ApplicationDbContextSeed seeder) { var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); if (env.IsDevelopment()) { seeder.Seed(); app.UseDeveloperExceptionPage(); app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(option => option.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.Description)); } app.UseMiddleware <CustomExceptionHandlerMiddleware>(); app.UseCustomHealthChecks(); app.UseHttpsRedirection(); app.UseAuthentication(); app.UseRouting(); app.UseCors("Open"); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// 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(); var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(swaggerOptions)).Bind(swaggerOptions); app.UseSwagger(options => { options.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(options => { options.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.Description); }); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseMvc(); }
// 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(); } // Enable Middelware to serve generated Swager as JSON endpoint var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); // Enable Middelware to serve Swagger UI (HTML, JavaScript, CSS etc.) app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerOptions.UIEndpoint, swaggerOptions.Description); }); // Enable Health Check Middleware app.UseHealthChecks("/health", new HealthCheckOptions { ResponseWriter = async(context, report) => { context.Response.ContentType = "application/json"; var response = new HealthCheckResponse() { Status = report.Status.ToString(), Checks = report.Entries.Select(x => new HealthCheck { Status = x.Value.Status.ToString(), Component = x.Key, Description = x.Value.Description }), Duration = report.TotalDuration }; await context.Response.WriteAsync(text: JsonConvert.SerializeObject(response)); } }); app.UseCustomExceptionHandler(); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// 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 SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(); app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerOptions.JsonRoute, swaggerOptions.Description); option.RoutePrefix = string.Empty; }); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public RequestExample( MvcOutputFormatter mvcOutputFormatter, IOptions <SwaggerOptions> options) { this.mvcOutputFormatter = mvcOutputFormatter; this.swaggerOptions = options?.Value; }
// 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.UseStaticFiles(); var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.Description); }); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IMapper mapper) { mapper.ConfigurationProvider.AssertConfigurationIsValid(); // if (env.IsDevelopment()) // { app.UseDeveloperExceptionPage(); // } SwaggerOptions swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(options => { options.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(options => { options.SwaggerEndpoint(swaggerOptions.UIEndpoint, swaggerOptions.Description); }); app.UseHsts(); // app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// 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(); } else { app.UseHsts(); } //config swagger var swaggerOption = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOption); app.UseSwagger(Options => { Options.RouteTemplate = swaggerOption.JsonRoute; }); app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerOption.UIEndpoint, swaggerOption.Decription); }); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
public static Task RunBatchEngineWebHosting(this IWebHostBuilder builder, string urls, SwaggerOptions swaggerOptions = null, IBatchInterceptor interceptor = null) { return(builder .PrepareBatchEngineMiddleware(interceptor) .ConfigureServices(services => { if (swaggerOptions == null) { // GetEntryAssembly() never returns null when called from managed code. var entryAsm = Assembly.GetEntryAssembly() !; var xmlName = entryAsm.GetName().Name + ".xml"; var xmlPath = Path.Combine(Path.GetDirectoryName(entryAsm.Location) ?? "", xmlName); swaggerOptions = new SwaggerOptions(entryAsm.GetName().Name, "", "/") { XmlDocumentPath = xmlPath }; } services.AddSingleton <SwaggerOptions>(swaggerOptions); }) .UseKestrel() .UseUrls(urls) .UseStartup <DefaultStartup>() .Build() .RunAsync()); }
/// <summary> /// 构建Swagger全局配置 /// </summary> /// <param name="swaggerOptions">Swagger 全局配置</param> /// <param name="configure"></param> internal static void Build(SwaggerOptions swaggerOptions, Action <SwaggerOptions> configure = null) { // 生成V2版本 swaggerOptions.SerializeAsV2 = _specificationDocumentSettings.FormatAsV2 == true; // 判断是否启用 Server if (_specificationDocumentSettings.HideServers != true) { // 启动服务器 Servers swaggerOptions.PreSerializeFilters.Add((swagger, request) => { // 默认 Server var servers = new List <OpenApiServer> { new OpenApiServer { Url = $"{request.Scheme}://{request.Host.Value}{_specificationDocumentSettings.VirtualPath}", Description = "Default" } }; servers.AddRange(_specificationDocumentSettings.Servers); swagger.Servers = servers; }); } // 配置路由模板 swaggerOptions.RouteTemplate = _specificationDocumentSettings.RouteTemplate; // 自定义配置 configure?.Invoke(swaggerOptions); }
// 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 SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(SwaggerOptions); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); //c.RoutePrefix = string.Empty; }); ConnectionString = Configuration.GetSection("ConnectionStrings:DefaultConnection").Value; app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// 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(); } var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(options => { options.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(options => options.SwaggerEndpoint(swaggerOptions.UIEndPoint, swaggerOptions.Description)); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseEndpoints(endpoints => { //endpoints.MapControllers(); endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapRazorPages(); }); }
// 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(); } 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(); } var swaggeroption = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggeroption); app.UseSwagger(option => { option.RouteTemplate = swaggeroption.JsonRoute; }); app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggeroption.UIEndpoint, swaggeroption.Description); }); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
// 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 SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(option => option.RouteTemplate = swaggerOptions.JsonRoute); app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.Description); }); app.UseHttpsRedirection(); app.UseRouting(); app.UseCors(builder => builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// 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 SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.Description); }); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSerilogRequestLogging(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// 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(); } 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.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCors("EnableCORS"); var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(options => { options.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(options => { options.SwaggerEndpoint(swaggerOptions.UIEndPoint, swaggerOptions.Description); }); app.UseMvc(); }
private static void SetupSwagger(SwaggerOptions options) { options.PreSerializeFilters.Add ( (swagger, httpReq) => swagger.Host = httpReq.Host.Value ); }
// 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 SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(options => { options.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(c => c.SwaggerEndpoint($"v{swaggerOptions.Version}{swaggerOptions.UiEndpoint}", swaggerOptions.Description)); /*app.UseHttpsRedirection(); * * app.UseHsts();*/ app.UseCors(o => o.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.InstallEndpointConfigInAssembly(env); app.WarmUpServices(Services, ServiceLifetime.Singleton); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerManager logger) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } //app.ConfigureExceptionHandler(logger); app.ConfigureCustomExceptionMiddleware(); app.UseStaticFiles(); var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(option => { option.RoutePrefix = "api"; option.SwaggerEndpoint(swaggerOptions.UIEndpoint, swaggerOptions.Description); }); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
/// <summary> /// Replaces standard <see cref="SwaggerMiddleware"/> with <see cref="ScopedSwaggerMiddleware"/>. /// Use instead of <see cref="SwaggerBuilderExtensions.UseSwagger"/> if you have services with scoped services like DbContext. /// </summary> public static IApplicationBuilder UseScopedSwagger(this IApplicationBuilder app, Action <SwaggerOptions> setupAction = null) { SwaggerOptions swaggerOptions = new SwaggerOptions(); setupAction?.Invoke(swaggerOptions); return(app.UseMiddleware <ScopedSwaggerMiddleware>(swaggerOptions)); }
// 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(); } else { app.UseHsts(); } var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(option => { option.SwaggerEndpoint(swaggerOptions.UiEndpoint, swaggerOptions.Description); }); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "/swagger"); }); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseAuthentication(); var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(opt => opt.RouteTemplate = swaggerOptions.JsonRoute); app.UseSwaggerUI(opt => opt.SwaggerEndpoint(swaggerOptions.UIEndpoint, swaggerOptions.Description)); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); serviceProvider.CreateUserRoles().GetAwaiter().GetResult(); }
public static IConveyBuilder AddSwaggerDocs(this IConveyBuilder builder, SwaggerOptions options) { if (!options.Enabled || !builder.TryRegister(RegistryName)) { return(builder); } builder.Services.AddSingleton(options); builder.Services.AddSwaggerGen(c => { c.EnableAnnotations(); c.SwaggerDoc(options.Name, new OpenApiInfo { Title = options.Title, Version = options.Version }); if (options.IncludeSecurity) { c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme { Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", Name = "Authorization", In = ParameterLocation.Header, Type = SecuritySchemeType.ApiKey }); } }); return(builder); }
public void ConfigureServices(IServiceCollection services) { SwaggerOptions = new SwaggerOptions(); var AppOptions = new AppOptions(); var JwtOptions = new JwtOptions(); var SendGridOptions = new SendGridClientOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(SwaggerOptions); Configuration.GetSection(nameof(AppOptions)).Bind(AppOptions); Configuration.GetSection(nameof(JwtOptions)).Bind(JwtOptions); Configuration.GetSection(nameof(SendGridClientOptions)).Bind(SendGridOptions); services.AddOptions(); services.Configure <SendGridOptions>(Configuration.GetSection(nameof(SendGridOptions))); services.Configure <AppOptions>(Configuration.GetSection(nameof(AppOptions))); services.Configure <JwtOptions>(Configuration.GetSection(nameof(JwtOptions))); services.Configure <SwaggerOptions>(Configuration.GetSection(nameof(SwaggerOptions))); services.Configure <IpRateLimitOptions>(Configuration.GetSection("IpRateLimiting")); services.Configure <IpRateLimitPolicies>(Configuration.GetSection("IpRateLimitPolicies")); services.Configure <RecaptchaSettings>(Configuration.GetSection("RecaptchaSettings")); services.AddCors(); services.ConfigureDbContext(AppOptions); services.Scan(scan => scan.FromAssemblyOf <Startup>() .AddClasses(classes => classes.AssignableToAny(typeof(IService), typeof(IRepository))) .AsMatchingInterface().WithScopedLifetime()); services.ConfigureApiVersioning(SwaggerOptions); services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); services.AddSingleton <IIpPolicyStore, MemoryCacheIpPolicyStore>(); services.AddSingleton <IRateLimitCounterStore, MemoryCacheRateLimitCounterStore>(); services.AddSingleton <IProcessingStrategy, AsyncKeyLockProcessingStrategy>(); services.ConfigureControllersForApi(AppOptions); services.ConfigureValidationErrorResponse(); services.ConfigureJWTAuth(JwtOptions); services.ConfigureSwagger(SwaggerOptions); services.AddMemoryCache(); services.AddSingleton <IActionContextAccessor, ActionContextAccessor>(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); // configuration (resolvers, counter key builders) services.AddSingleton <IRateLimitConfiguration, RateLimitConfiguration>(); services.AddScoped <IUrlHelper>(factory => new UrlHelper(factory.GetService <IActionContextAccessor>().ActionContext)); services.AddTransient <IRecaptchaService, RecaptchaService>(); services.AddPwnedPasswordHttpClient(); _ = services.AddSingleton <ISendGridClient, SendGridClient>(_ => new SendGridClient(SendGridOptions)); services.AddSingleton <ISendGridService, SendGridService>(); }
// 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(); } //health checks // app.UseHealthChecks("/health"); app.UseHealthChecks("/health", new HealthCheckOptions { ResponseWriter = async(context, report) => { context.Response.ContentType = "application/json"; var response = new HealthCheckResponse { Status = report.Status.ToString(), Checks = report.Entries.Select(x => new HealthCheck { Component = x.Key, Status = x.Value.Status.ToString(), Description = x.Value.Description }), Duration = report.TotalDuration }; await context.Response.WriteAsync(JsonConvert.SerializeObject(response)); } }); #region Swager#1 var swaggerOptions = new SwaggerOptions(); Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); app.UseSwagger(options => { options.RouteTemplate = swaggerOptions.JsonRoute; }); app.UseSwaggerUI(options => { options.SwaggerEndpoint(swaggerOptions.UIEndpoint, swaggerOptions.Description); }); #endregion app.UseHttpsRedirection(); app.UseStaticFiles(); //JWT token app.UseAuthentication(); //Its Ok app.UseMvc(); }
private static SwaggerOptions GetSwaggerOptions(IConfiguration configuration) { var swaggerOptions = new SwaggerOptions(); configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions); return(swaggerOptions); }
public void SwaggerAddBaseUrlOnRequestFiltersTest_Successful() { var options = new SwaggerOptions(); options.AddBaseUrl(new Uri("https://petstore3.swagger.io/")); Assert.Equal("https://petstore3.swagger.io/", options.BaseUrl.ToString()); }
private static void AddDefaultSchemaGeneratorOptions(SwaggerOptions options) { if (options.DefaultSchemaIdSelector && options.SchemaGeneratorOptions.SchemaIdSelector.Method.Name == "DefaultSchemaIdSelector") { options.CustomSchemaIds(type => SchemaIdGenerator.SchemaIdSelector(type)); } }