Пример #1
0
 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");
 }
Пример #2
0
 /// <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");
 }
Пример #3
0
 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();
 }
Пример #4
0
        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");
        }
Пример #5
0
        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");
        }
Пример #6
0
        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");
        }
Пример #7
0
 /// <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);