概述
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 设置值可以为空_如何为Swagger UI定义参数的默认值?所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复