Wlniao.OpenApi
1.2.1
dotnet add package Wlniao.OpenApi --version 1.2.1
NuGet\Install-Package Wlniao.OpenApi -Version 1.2.1
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="Wlniao.OpenApi" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Wlniao.OpenApi" Version="1.2.1" />
<PackageReference Include="Wlniao.OpenApi" />
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 Wlniao.OpenApi --version 1.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Wlniao.OpenApi, 1.2.1"
#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 Wlniao.OpenApi@1.2.1
#: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=Wlniao.OpenApi&version=1.2.1
#tool nuget:?package=Wlniao.OpenApi&version=1.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
xcore
Wlniao.OpenApi for .NET CORE
License
Add Package
dotnet add package Wlniao.OpenApi
Usage
注册Swagger服务
builder.Services.AddSwaggerExtend(new System.Collections.Generic.List<ApiGroupInfo> {
new ApiGroupInfo { Name = "Service", Title = "对外开放服务接口" },
new ApiGroupInfo { Name = "Control", Title = "内部管理服务接口" }
});
配置前端终结点
app.UseKnife4UI(o =>
{
o.RoutePrefix = "docs";
ApiGroupInfo.GroupInfos.ForEach(group => { o.SwaggerEndpoint("../swagger" + group.ApiUrl, group.Title); });
});
自定义参数特性
在 Action 上标注即可补充文档,无需声明对应形参:
[HttpPost("query")]
[XDomain] // 注入 X-Domain 请求头
[AuthHeader] // 注入 Authorization 请求头
[WlniaoPostParameter(Name = "TraceId", Type = typeof(string), Required = true, Description = "调用链ID")]
[WlniaoQueryParameter(Name = "page", Description = "页码")]
[WlniaoBodyParameter(Type = typeof(RequestModel), Required = true, Description = "请求体")]
public string Query() => "";
WlniaoPostParameter会把这些字段合并成一个动态对象作为请求体(text/json与application/json);WlniaoBodyParameter仅在接口自身未声明请求体时生效,ReferenceId用于直接$ref引用components/schemas下的既有架构:[WlniaoBodyParameter(ReferenceId = "RequestModel")]。
依赖版本
本包锁定 Swashbuckle.AspNetCore.SwaggerGen 10.3.1 + Microsoft.OpenApi [2.7.5]。
Microsoft.OpenApi 不要提升到 3.x:该版本的 IOpenApiRequestBody.Content 等成员签名与 Swashbuckle 10.3.1 编译时依赖不一致,运行时会抛 MissingMethodException。
| 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 was computed. 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
- IGeekFan.AspNetCore.Knife4jUI (>= 0.0.16)
- Microsoft.OpenApi (= 2.7.5)
- Swashbuckle.AspNetCore.SwaggerGen (>= 10.3.1)
- Wlniao.XCore (>= 10.0.1)
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 |
|---|---|---|
| 1.2.1 | 112 | 11/3/2026 |
| 1.1.1 | 309 | 8/19/2025 |
| 1.1.0 | 302 | 8/8/2025 |
| 1.0.10 | 439 | 9/1/2024 |
| 1.0.9 | 259 | 8/31/2024 |
| 1.0.8 | 223 | 8/30/2024 |
| 1.0.7 | 235 | 8/27/2024 |
| 1.0.6 | 243 | 8/26/2024 |
| 1.0.5 | 213 | 7/10/2024 |
| 1.0.4 | 246 | 6/29/2024 |
| 1.0.3 | 248 | 6/29/2024 |
| 1.0.2 | 224 | 6/13/2024 |
| 1.0.1 | 227 | 6/12/2024 |
| 1.0.0 | 218 | 6/12/2024 |