-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce43ce5
commit e42c7bd
Showing
10 changed files
with
180 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...ing.Extensions.Swashbuckle/Bing/Swashbuckle/Filters/Documents/TagReOrderDocumentFilter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System.Linq; | ||
using Microsoft.OpenApi.Models; | ||
using Swashbuckle.AspNetCore.SwaggerGen; | ||
|
||
namespace Bing.Swashbuckle.Filters.Documents | ||
{ | ||
/// <summary> | ||
/// 标识重新排序 文档过滤器。用于对控制器进行排序 | ||
/// </summary> | ||
internal class TagReOrderDocumentFilter : IDocumentFilter | ||
{ | ||
/// <summary> | ||
/// 是否降序排序 | ||
/// </summary> | ||
private readonly bool _orderByDesc; | ||
|
||
/// <summary> | ||
/// 初始化一个<see cref="TagReOrderDocumentFilter"/>类型的实例 | ||
/// </summary> | ||
/// <param name="orderByDesc">是否降序排序</param> | ||
public TagReOrderDocumentFilter(bool orderByDesc = false) => _orderByDesc = orderByDesc; | ||
|
||
/// <summary> | ||
/// 重写操作处理 | ||
/// </summary> | ||
public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) | ||
{ | ||
swaggerDoc.Tags = _orderByDesc | ||
? swaggerDoc.Tags.OrderByDescending(tag => tag.Name).ToList() | ||
: swaggerDoc.Tags.OrderBy(tag => tag.Name).ToList(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/Bing.Extensions.Swashbuckle/Bing/Swashbuckle/TokenStorageParameter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
namespace Bing.Swashbuckle | ||
{ | ||
/// <summary> | ||
/// 令牌存储参数。用于拦截登录后存储令牌,解决刷新页面导致令牌丢失问题 | ||
/// </summary> | ||
internal class TokenStorageParameter | ||
{ | ||
/// <summary> | ||
/// 授权定义。对应于 AddSecurityDefinition 中的 name | ||
/// </summary> | ||
public string SecurityDefinition { get; set; } | ||
|
||
/// <summary> | ||
/// 网页缓存类型 | ||
/// </summary> | ||
public WebCacheType CacheType { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// 网页缓存方式 | ||
/// </summary> | ||
public enum WebCacheType | ||
{ | ||
/// <summary> | ||
/// 本地存储 | ||
/// </summary> | ||
Local, | ||
/// <summary> | ||
/// 会话 | ||
/// </summary> | ||
Session, | ||
} | ||
} |