EasilyNET.WebCore.Swagger 3.24.1003.33

There is a newer version of this package available.
See the version list below for details.
dotnet add package EasilyNET.WebCore.Swagger --version 3.24.1003.33                
NuGet\Install-Package EasilyNET.WebCore.Swagger -Version 3.24.1003.33                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasilyNET.WebCore.Swagger" Version="3.24.1003.33" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasilyNET.WebCore.Swagger --version 3.24.1003.33                
#r "nuget: EasilyNET.WebCore.Swagger, 3.24.1003.33"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EasilyNET.WebCore.Swagger as a Cake Addin
#addin nuget:?package=EasilyNET.WebCore.Swagger&version=3.24.1003.33

// Install EasilyNET.WebCore.Swagger as a Cake Tool
#tool nuget:?package=EasilyNET.WebCore.Swagger&version=3.24.1003.33                

EasilyNET.WebCore.Swagger

将 Swagger 的扩展独立出来,避免 WebCore 的过度依赖.

  • 新增 Swagger 页面参数忽略.比如某些默认参数不需要调用者传入,并且也不希望他看见
  • 接口隐藏,或者控制器隐藏

添加默认值显示 代码示例

  • 在 Swagger 文档中给需要 Authorize 的接口添加 🔒

最新变化

  • SwaggerIgnoreAttribute由于官方已经提供了同名特性,所以这里删除相关代码.

可用特性

  • ApiGroupAttribute 对控制器进行分组.便于将特有的功能分到一个组方便管理.
  • HiddenApiAttribute 隐藏控制器或者单个接口.
  • SwaggerIgnoreAttribute 忽略接口参数或者传入实体的属性 代码示例

如何使用?

// 添加 Swagger 服务
private const string name = $"{title}-{version}";

private const string version = "v1";
private const string title = "WebApi.Test";

builder.Services.AddSwaggerGen(c =>
{
    // 配置默认的文档信息
    c.SwaggerDoc(name, new()
    {
        Title = title,
        Version = version,
        Description = "Console.WriteLine(\"🐂🍺\")"
    });
    // 这里使用EasilyNET提供的扩展配置.
    c.EasilySwaggerGenOptions(name);
    // 配置认证方式
    c.AddSecurityDefinition("Bearer", new()
    {
        Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
        Name = "Authorization",
        In = ParameterLocation.Header,
        Type = SecuritySchemeType.ApiKey,
        Scheme = "Bearer"
    });
});

...

// 注册 Swagger 中间件
app.UseSwagger().UseSwaggerUI(c =>
{
    // 配置默认文档
    c.SwaggerEndpoint($"/swagger/{name}/swagger.json", $"{title} {version}");
    // 使用EasilyNET提供的扩展配置
    c.EasilySwaggerUIOptions();
});

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.24.1224.141 31 12/24/2024
3.24.1216.116 78 12/16/2024
3.24.1206.100 86 12/6/2024
3.24.1205.171 89 12/5/2024
3.24.1202.150 75 12/2/2024
3.24.1126.231 76 11/26/2024
3.24.1126.172 74 11/26/2024
3.24.1126.114 72 11/26/2024
3.24.1126.104 74 11/26/2024
3.24.1125.181 64 11/25/2024
3.24.1125.104 79 11/25/2024
3.24.1121.183 85 11/21/2024
3.24.1120.183 84 11/20/2024
3.24.1119.31 81 11/18/2024
3.24.1115.143 66 11/15/2024
3.24.1113.100 81 11/13/2024
3.24.1112.125 89 11/12/2024
3.24.1107.140 80 11/7/2024
3.24.1107.54 83 11/7/2024
3.24.1107.34 80 11/7/2024
3.24.1105.111 86 11/5/2024
3.24.1103.31 84 11/2/2024
3.24.1103 85 11/2/2024
3.24.1031.135 77 10/31/2024
3.24.1031.112 74 10/31/2024
3.24.1031.104 72 10/31/2024
3.24.1029.142 96 10/29/2024
3.24.1025.30 88 10/24/2024
3.24.1022.142 72 10/22/2024
3.24.1018.204 141 10/18/2024
3.24.1018.175 132 10/18/2024
3.24.1018.166 134 10/18/2024
3.24.1018.93 139 10/18/2024
3.24.1017.42 89 10/16/2024
3.24.1016.161 85 10/16/2024
3.24.1015.231 94 10/15/2024
3.24.1015.14 86 10/14/2024
3.24.1012.114 95 10/12/2024
3.24.1009.115 93 10/9/2024
3.24.1008.160 80 10/8/2024
3.24.1008.133 85 10/8/2024
3.24.1007.185 77 10/7/2024
3.24.1003.33 89 10/2/2024
3.24.1002.162 84 10/2/2024
3.24.929.143 85 9/29/2024
3.24.929.141 103 9/29/2024
3.24.929.131 85 9/29/2024
3.24.929.122 86 9/29/2024
3.24.926.184 98 9/26/2024
3.24.926.182 84 9/26/2024
3.24.926.175 94 9/26/2024
3.24.924.160 81 9/24/2024
3.24.924.133 107 9/24/2024
3.24.924.124 85 9/24/2024
3.24.924.10 95 9/23/2024
3.24.924.1 83 9/23/2024
3.24.923.234 91 9/23/2024
3.24.923.232 89 9/23/2024
3.24.923.155 90 9/23/2024
3.24.919.92 99 9/19/2024
3.24.914.125 123 9/14/2024
3.24.914.115 110 9/14/2024
3.24.914.111 128 9/14/2024
3.24.911.95 111 9/11/2024
3.24.908.215 103 9/8/2024
3.24.904.200 103 9/4/2024
3.24.828.163 121 8/28/2024
3.24.820.173 127 8/20/2024
3.24.814.92 116 8/14/2024
3.24.812.115 137 8/12/2024
3.24.802.100 109 8/2/2024
3.24.801.162 87 8/1/2024
3.24.801.160 109 8/1/2024
3.24.730.164 75 7/30/2024
3.24.730.91 81 7/30/2024
3.24.724.91 79 7/24/2024
3.24.718.105 124 7/18/2024
3.24.716.95 103 7/16/2024
3.24.712.94 98 7/12/2024
3.24.710.14 106 7/9/2024
3.24.709.105 118 7/9/2024
3.24.704.94 120 7/4/2024
3.24.701.90 107 7/1/2024
3.24.628.114 110 6/28/2024
3.24.627.145 105 6/27/2024
3.24.620.160 113 6/20/2024
3.24.613.115 106 6/13/2024
3.24.612.95 95 6/12/2024
3.24.528.90 108 5/28/2024
3.24.522.84 124 5/22/2024
3.24.512.213 93 5/12/2024
3.24.508.112 115 5/8/2024
2.2024.428.71 111 4/28/2024
2.2024.427.1128 121 4/27/2024
2.2.72 132 4/14/2024
2.2.71 125 4/12/2024
2.2.8 99 4/26/2024
2.2.6 111 4/10/2024
2.2.5 131 3/26/2024
2.2.4 118 3/25/2024
2.2.3 132 3/24/2024
2.2.2 156 3/21/2024
2.2.1 134 3/20/2024
2.2.0 136 3/13/2024
2.1.9 149 2/21/2024
2.1.8 110 2/18/2024
2.1.7 120 2/16/2024
2.1.6 125 2/14/2024
2.1.5 117 2/14/2024
2.1.4 147 2/9/2024
2.1.3 145 2/8/2024
2.1.2 134 2/5/2024
2.1.1.2 204 12/26/2023
2.1.1.1 155 12/26/2023
2.1.1 155 12/25/2023
2.1.0 150 12/17/2023
2.0.11 226 12/6/2023
2.0.1 213 11/15/2023
2.0.0 165 11/14/2023
1.9.1 165 11/1/2023
1.9.0 166 10/19/2023
1.9.0-preview2 290 10/12/2023
1.9.0-preview1 148 10/12/2023
1.8.9 199 10/11/2023
1.8.8 172 10/11/2023
1.8.7-rc2 152 9/21/2023
1.8.7-rc1 154 9/12/2023
1.8.6 210 8/31/2023
1.8.5 820 8/25/2023
1.8.4 186 8/24/2023
1.8.3 210 8/23/2023
1.8.2 239 8/22/2023
1.8.1 211 8/18/2023
1.8.0 183 8/15/2023
1.7.9 211 8/11/2023
1.7.8 171 8/11/2023
1.7.7 199 8/10/2023
1.7.6 190 8/9/2023
1.7.5 237 8/9/2023
1.7.4 294 8/3/2023
1.7.3 212 8/1/2023
1.7.2 196 7/31/2023
1.7.1 170 7/27/2023
1.7.0 199 7/25/2023
1.6.9 223 7/25/2023
1.6.8 194 7/24/2023
1.6.7 217 7/20/2023
1.6.6 198 7/19/2023
1.6.5 174 7/19/2023
1.6.4 190 7/17/2023
1.6.3 179 7/17/2023
1.6.2 253 7/12/2023
1.6.1 260 6/30/2023
1.6.0 180 6/26/2023
1.5.9 217 6/22/2023
1.5.8 240 6/15/2023
1.5.7.1 224 6/14/2023
1.5.7 233 6/14/2023
1.5.6.2 235 6/7/2023
1.5.6.1 205 6/7/2023
1.5.6 205 6/7/2023
1.5.5.2 257 5/26/2023
1.5.5.1 221 5/26/2023
1.5.5 226 5/26/2023
1.5.4.4 198 5/25/2023
1.5.4.3 221 5/23/2023
1.5.4.2 291 5/17/2023
1.5.4.1 189 5/16/2023
1.5.4 282 5/11/2023
1.5.3 199 5/11/2023
1.5.2 229 5/10/2023
1.5.1 191 5/10/2023
1.5.0 239 5/6/2023
1.4.0 212 5/5/2023
1.3.9 263 4/23/2023