asp.net-core – 找不到Swashbuckle.AspNetCore SwaggerOperation属性
发布时间:2020-10-19 17:26:53 所属栏目: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 Web应用程序安全性不适用于IIS 7?
- 在asp.net mvc中如何使用usercontrols来显示“岛”数据?
- asp.net-mvc – ASP.NET MVC如何实现返回上一页的链接?
- asp.net – 基于函数式编程的UI
- asp.net-mvc-3 – 为什么@ Html.Label()删除一些字符
- asp.net-mvc – Nhibernate / MVC:在View中处理延迟加载的
- asp.net-mvc – 使用类似MvcContrib Grid的东西在代码可读性
- asp.net – 如何在gridview中将navigateurl添加到超链接
- asp.net – 如何以二进制格式下载存储在SQL DB中的文件
- 受asp.net MVC启发的更好的WebForms
推荐文章
站长推荐
- ASP.NET Core 1.0 ConfigurationBuilder().AddJs
- asp.net下使用jquery 的ajax+WebService+json 实
- asp.net-mvc – MVC项目中的System.Globalizatio
- 有什么好的参考或工具可用于将ASP转换为ASP.NET?
- VS 2015.为ASP.NET 5 web项目设置正确的目标框架
- Asp.net实现MVC处理文件的上传下载功能实例教程
- asp.net – 转发器控件中的单选按钮列表
- asp.net-mvc-3 – MVC3非顺序索引和DefaultModel
- ASP.NET:隐藏gridview中的列
- asp.net-mvc-3 – ASP.Net MVC 3:在哪里处理会话
热点阅读