【发布时间】:2020-09-19 20:23:41
【问题描述】:
我正在使用 NSwag 为我的 asp.net 核心 web api 生成 C# rest 客户端。目前,我只需要生成客户端接口而不是类本身。我尝试了以下设置来仅生成 C# 客户端接口,但它既不生成也不生成接口。
GenerateClientClasses = false
GenerateClientInterfaces = true
我的设置有什么问题吗?
另外,有没有办法扩展或更改客户端接口的生成代码。例如,如何使用一些自定义属性注释客户端接口方法?例如:
public partial interface IGetEmployeeByIdClient
{
// How to add the following custom attributes to the generated client interface method
[MyCustomerAttribute("/api/v1/GetEmployeeById/{id}"] )
System.Threading.Tasks.Task<GetEmployeeByIdQueryResult> GetEmployeeByIdAsync(string id);
}
【问题讨论】:
-
我也遇到了同样的问题,请问你有什么进展吗?
标签: c# .net dotnet-httpclient nswag