我是靠谱客的博主 大方豌豆,最近开发中收集的这篇文章主要介绍swagger3 设置值可以为空_如何为Swagger UI定义参数的默认值?,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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定义参数的默认值?所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部