C#Web API 2.0中的Swagger响应模型为空

问题描述

我想使用swashbuckle在招摇中显示http状态代码> = 400的响应消息。不幸的是,它在UI上始终成为空对象;如果我在“ swagger response”属性中更改了http状态代码200,它将起作用。您对此有任何解决方案,还是可以解决

这有效

[SwaggerResponse(200,type: typeof(Dictionary<string,object>),description: "Successfully found the data")]
[SwaggerResponseExample(HttpStatusCode.OK,typeof(DictionaryResponseExample))]

这失败了

[SwaggerResponse(500,description: "Coud not found the data")]
[SwaggerResponseExample(HttpStatusCode.InternalServerError,typeof(DictionaryResponseExample))]

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)