public static void ConfigureUI(SwaggerUIOptions options, IConfiguration config) { options.SwaggerEndpoint("/swagger/v1/swagger.json", "V1 Api"); options.RoutePrefix = ""; options.SupportedSubmitMethods(new SubmitMethod[0]); options.InjectStylesheet("/swagger-custom-styles.css"); }
/// <summary> /// 使用内部资源。 /// </summary> /// <param name="options">SwaggerUI选项</param> public static void UseInternalResources(this SwaggerUIOptions options) { options.InjectJavascript("resources?name=jquery-3.3.1.min.js"); options.InjectJavascript("resources?name=jquery.initialize.min.js"); //options.InjectJavascript("/swagger/resources?name=export.js"); options.InjectStylesheet("resources?name=swagger-common.css"); }
private static void ConfigureSwaggerUI(SwaggerUIOptions swaggerUI) { swaggerUI.DocumentTitle = "Martian Robots OpenAPI"; swaggerUI.SwaggerEndpoint("./openapi.json", "live"); swaggerUI.DefaultModelsExpandDepth(-1); swaggerUI.DisplayRequestDuration(); swaggerUI.InjectStylesheet("./openapi.css"); swaggerUI.InjectJavascript("./openapi.js"); swaggerUI.EnableDeepLinking(); }
public static void ConfigureSwaggerUI(SwaggerUIOptions swaggerUIOptions) { var webApiAssembly = Assembly.GetEntryAssembly(); var apiVersions = GetApiVersions(webApiAssembly); foreach (var apiVersion in apiVersions) { swaggerUIOptions.SwaggerEndpoint($"/api-docs/v{apiVersion}/swagger.json", $"V{apiVersion} Docs"); } swaggerUIOptions.RoutePrefix = "api-docs"; swaggerUIOptions.InjectStylesheet("theme-feeling-blue-v2.css"); }
internal static void ConfigureSwaggerUI(SwaggerUIOptions swaggerUIOptions) { var webApiAssembly = Assembly.GetEntryAssembly(); var apiVersions = GetApiVersions(webApiAssembly); foreach (var apiVersion in apiVersions) { swaggerUIOptions.SwaggerEndpoint($"v{apiVersion}/swagger.json", $"V{apiVersion} Docs"); } swaggerUIOptions.RoutePrefix = "api-docs"; swaggerUIOptions.ShowRequestHeaders(); swaggerUIOptions.ShowJsonEditor(); swaggerUIOptions.InjectStylesheet("theme-feeling-blue-v2.css"); swaggerUIOptions.InjectOnCompleteJavaScript("CustomisedSwagger.js"); }
public static void ConfigureSwaggerUI(SwaggerUIOptions swaggerUIOptions) { var webApiAssembly = Assembly.GetEntryAssembly(); var apiVersions = GetApiVersions(webApiAssembly); var path = string.Concat(Directory.GetCurrentDirectory(), Path.DirectorySeparatorChar, "config", Path.DirectorySeparatorChar); IConfigurationRoot configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile($"{path}appsettings.json") .Build(); var appPrefixDir = configuration.GetValue <string>("AppPrefixDir"); foreach (var apiVersion in apiVersions) { swaggerUIOptions.SwaggerEndpoint($"{appPrefixDir}/api-docs/v{apiVersion}/swagger.json", $"V{apiVersion} Docs"); } swaggerUIOptions.RoutePrefix = "api-docs"; swaggerUIOptions.InjectStylesheet("theme-feeling-blue-v2.css"); }
/// <summary> /// Use this to enable the collector style-sheet /// </summary> /// <param name="swaggerUiOptions"> /// The swagger User Interface Config /// </param> public static void InjectCollectorTheme(this SwaggerUIOptions swaggerUiOptions) => swaggerUiOptions.InjectStylesheet(Constants.Route + Constants.Css);