I have Swagger/Swashbuckle integrated into a .NET Core 2.2 API project. Everything works great and what I am asking is purely for convenience. Consider the following API method:
public Model SomeEstimate(SomeRequest request) {
return Manager.GetSomeEstimate(request);
}
...
public class SomeRequest {
public string StreetAddress { get; set; }
public string Zip { get; set; }
}
When I hit /swagger/index.html and want to try out this API, I always have to enter the StreetAddress and Zip values.
Is there a way to provide default values for StreetAddress and Zip? This answer suggested placing [DefaultValue("value here")] attribute each property of the SomeRequest class. It may have worked for the regular .NET, but not with .NET Core.
Is it possible to provide default values for parameters for
最后
以上就是大方豌豆最近收集整理的关于swagger3 设置值可以为空_如何为Swagger UI定义参数的默认值?的全部内容,更多相关swagger3内容请搜索靠谱客的其他文章。
发表评论 取消回复