asp.net-core – 找不到Swashbuckle.AspNetCore SwaggerOperation属性
发布时间:2020-10-19 15:18:10 所属栏目: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-api – WebAPI:403在发布网站后被禁止
- asp.net-mvc-4 – 全局过滤器MVC 4的执行顺序是什么
- asp.net-mvc – 在ASP.NET身份中角色与声明的最佳实践
- asp.net – 使用/ signalr / ping调用时使用长轮询
- asp.net-mvc – 在Azure Active Directory B2C中按组授权
- asp.net-core – .NET Core SDK安装程序无法在Windows 2012
- asp.net – 在我的网站中添加HttpModule时出现“500内部服务
- asp.net-mvc – ASP.Net MVC – HTTP状态代码(即303,401,40
- 使用ASP.NET AJAX Control Toolkit设置焦点
- ASP.NET缓存的方法和最佳实践
推荐文章
站长推荐
- ASP.NET 5,.NET Core和ASP.NET Core 5有什么区别
- asp.net-mvc – 使用Entity FrameWork保存更改/更
- asp.net-mvc – ASP.NET MVC中的代码
- ASP.Net MVC cookies – 防篡改?
- asp.net-mvc – asp.net MVC antiorgerytoken异常
- 为什么ASP.NET回发时请求cookie属性为null或不正
- asp-classic – 如何使用Microsoft.XMLHTTP指定代
- asp.net-mvc-2 – 带有数组/列表的ASP.NET MVC 2
- asp.net-mvc-3 – MVC 3不显眼的验证 – 有条件地
- asp.net-mvc – ASP.NET MVC V2 – 好友类
热点阅读
