Exemplo n.º 1
0
        private void SetSwaggerOptions(SwaggerUIOptions options)
        {
            string settingKey  = Constant.AppSettingKey.AppApiEndpointUrl;
            string endpointUrl = AppSetting.GetValue(settingKey);

            settingKey = Constant.AppSettingKey.AppApiVersion;
            string apiVersion = AppSetting.GetValue(settingKey);

            options.SwaggerEndpoint(endpointUrl, apiVersion);
            options.ShowRequestHeaders();
            options.ShowJsonEditor();
        }
Exemplo n.º 2
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");
        }