EasilyNET.WebCore.Swagger
3.24.802.100
The owner has unlisted this package.
This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package EasilyNET.WebCore.Swagger --version 3.24.802.100
NuGet\Install-Package EasilyNET.WebCore.Swagger -Version 3.24.802.100
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.802.100" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EasilyNET.WebCore.Swagger" Version="3.24.802.100" />
<PackageReference Include="EasilyNET.WebCore.Swagger" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EasilyNET.WebCore.Swagger --version 3.24.802.100
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EasilyNET.WebCore.Swagger, 3.24.802.100"
#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.
#:package EasilyNET.WebCore.Swagger@3.24.802.100
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EasilyNET.WebCore.Swagger&version=3.24.802.100
#tool nuget:?package=EasilyNET.WebCore.Swagger&version=3.24.802.100
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions 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. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- EasilyNET.WebCore (>= 3.24.802.100)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.7.0)
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.7.0)
-
net9.0
- EasilyNET.WebCore (>= 3.24.802.100)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.7.0)
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.7.0)
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 |
|---|