问题描述
我正在使用Swashbuckle 5.6生成OpenAPI规范,并使用Nswag 13.7.3生成c#客户端和模型。我想知道当前是否可以通过这种控制器(带有查询参数的GET)生成客户端方法
public class TestController
{
[HttpGet]
public string GetComplex([FromQuery] ComplexType input )..
}
public class ComplexType
{
public string Name {get; set;}
public int Age {get; set;}
}
致此客户
public class Client
{
public string GetComplex(ComplexType type)...
}
代替
public class Client
{
public string GeComplex(strung name,int age)..
}
解决方法
我想知道当前是否可以从这种控制器(带有查询参数的GET)生成客户端方法
是的,这是模型绑定的默认行为。我使用您的代码进行了测试。
官方教程链接: