asp.net-core – 找不到Swashbuckle.AspNetCore SwaggerOperation属性
发布时间:2020-10-19 14:05:45 所属栏目:asp.Net 来源:互联网
导读:我正在尝试使用Swashbuckle.AspNetCore(3.0.0)帮助创建的Autorest和Swagger文档来生成REST API客户端. 生成的swagger文档似乎是正确的,除了操作名称不是很好. /api/Addresses/{id}: { get: { tags: [ Address ], operationId:
|
我正在尝试使用Swashbuckle.AspNetCore(3.0.0)帮助创建的Autorest和Swagger文档来生成REST API客户端. 生成的swagger文档似乎是正确的,除了操作名称不是很好. "/api/Addresses/{id}": {
"get": {
"tags": [ "Address" ],"operationId": "ApiAddressesByIdGet","consumes": [],"produces": [],"parameters": [
{
"name": "id","in": "path","required": true,"type": "string","format": "uuid"
}
],"responses": { "200": { "description": "Success" } }
},
我在许多文章和SwashBuckle.AspNetCore的官方文档中看到我可以使用属性来装饰我的控制器方法,如下所示: [HttpGet]
[Produces("application/json")]
[ProducesResponseType((int)HttpStatusCode.NotFound)]
[ProducesResponseType(typeof(List<AddressDto>),(int)HttpStatusCode.OK)]
[SwaggerOperation("GetAllAdresses")]
public async Task<IActionResult> GetAllAsync()
{
....
}
不幸的是,我收到了一个错误:无法找到SwaggerOperationAttribute! 我验证了安装的nuget包,它们是: > SwashBuckle.AspNetCore.Swagger(3.0.0) 有人可以帮帮我吗?请 解决方法我今天碰到了这个.我需要添加以下为V3.0.0添加的nuget包:Swashbuckle.AspNetCore.Annotations 突破性变化描述于here (编辑:长春站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 所有请求获取HTTP错误401.2 – 未经授权的响
- asp.net-mvc – 如何检测移动浏览器,并将适当的内容指向它?
- asp.net-core – 加密ASP.Net Core中的连接字符串和其他配置
- asp.net-mvc – 缩小ASP.NET MVC中的Action Filter属性
- asp.net-mvc – 在IIS 5.1上部署ASP.NET MVC(Windows XP)
- asp.net类序列化生成xml文件实例详解
- asp.net – 如何从复选框列表中获取最新的选定值?
- ASP.NET两个截取字符串的方法分享
- 用Dataset对象读取XML内容来绑定下拉列表框
- 在ASP.NET Core中使用AOP来简化缓存操作
推荐文章
站长推荐
- ASP.NET:从C#代码隐藏显示警报
- entity-framework – 如果EF 5,如何定义自定义命
- asp.net – 在部分视图中强制使用没有Html.Begin
- asp.net-mvc – 值不能为空或为空.参数名称:con
- asp.net-identity交易问题
- asp.net-mvc – MicrosoftMvcValidation.js VS j
- ASP.NET(AJAX+JSON)实现对象调用
- asp.net – 从启用AJAX的WCF服务返回错误详细信息
- asp.net-mvc – ASP.NET MVC推荐的依赖注入框架是
- asp.net – MVC 4导出到CSV – 另存为对话框在Ch
热点阅读
