Пример #1
0
 /// <summary>
 /// 使用默认SwggerUI
 /// </summary>
 /// <param name="options">SwaggerUI配置</param>
 // ReSharper disable once InconsistentNaming
 public static void UseDefaultSwaggerUI(this SwaggerUIOptions options)
 {
     options.DefaultModelExpandDepth(2);                    // 接口列表折叠配置
     options.DefaultModelRendering(ModelRendering.Example); // 控制首次呈现API时模型的显示方式(模型|示例)。
     options.ShowExtensions();                              // 显示扩展信息
     options.DefaultModelsExpandDepth(-1);                  // 隐藏model
     options.DisplayOperationId();                          // 显示控制器接口方法名
     options.DisplayRequestDuration();                      // 显示请求持续时间(以毫秒为单位)
     options.DocExpansion(DocExpansion.None);               // 文档显示方式:显示控制器
     options.EnableDeepLinking();                           // 启用深层连接,用于指定Url自动跳转到相应标签
     options.EnableFilter();                                // 启用过滤文本框
 }
 /// <summary>
 /// Set up some properties for swagger UI
 /// </summary>
 /// <param name="settings"></param>
 public static void SwaggerSettings(SwaggerUIOptions settings)
 {
     settings.SwaggerEndpoint(SwaggerConfig, $"{AppTitle} v.{AppVersion}");
     settings.RoutePrefix   = SwaggerUrl;
     settings.DocumentTitle = "Microservice API";
     settings.DefaultModelExpandDepth(0);
     settings.DefaultModelRendering(ModelRendering.Model);
     settings.DefaultModelsExpandDepth(0);
     settings.DocExpansion(DocExpansion.None);
     settings.OAuthClientId("microservice1");
     settings.OAuthScopeSeparator(" ");
     settings.OAuthClientSecret("secret");
     settings.DisplayRequestDuration();
     settings.OAuthAppName("Microservice API (with IdentityServer4) module API documentation");
 }
 /// <summary>
 /// Set up some properties for swagger UI
 /// </summary>
 /// <param name="settings"></param>
 public static void SwaggerSettings(SwaggerUIOptions settings)
 {
     settings.SwaggerEndpoint(SwaggerConfig, $"{AppTitle} v.{AppVersion}");
     settings.HeadContent   = $"{ThisAssembly.Git.Branch.ToUpper()} {ThisAssembly.Git.Commit.ToUpper()}";
     settings.DocumentTitle = $"{AppTitle}";
     settings.DefaultModelExpandDepth(0);
     settings.DefaultModelRendering(ModelRendering.Model);
     settings.DefaultModelsExpandDepth(0);
     settings.DocExpansion(DocExpansion.None);
     settings.OAuthClientId("microservice1");
     settings.OAuthScopeSeparator(" ");
     settings.OAuthClientSecret("secret");
     settings.DisplayRequestDuration();
     settings.OAuthAppName("Microservice module API");
 }
 /// <summary>
 /// Set up some properties for swagger UI
 /// </summary>
 /// <param name="settings"></param>
 public static void SwaggerSettings(SwaggerUIOptions settings)
 {
     settings.SwaggerEndpoint(SwaggerConfig, $"{AppTitle} v.{AppVersion}");
     settings.RoutePrefix   = SwaggerUrl;
     settings.DocumentTitle = "Catalog API documentation";
     settings.DefaultModelExpandDepth(0);
     settings.DefaultModelRendering(ModelRendering.Model);
     settings.DefaultModelsExpandDepth(0);
     settings.DocExpansion(DocExpansion.None);
     settings.OAuthClientId("microservice1");
     settings.OAuthScopeSeparator(" ");
     settings.OAuthClientSecret("secret");
     settings.DisplayRequestDuration();
     settings.OAuthAppName("Micro service");
     settings.OAuthUseBasicAuthenticationWithAccessCodeGrant();
 }