【发布时间】:2019-05-09 06:32:45
【问题描述】:
我将在我的控制器上使用这些属性:
[SwaggerResponse((int)HttpStatusCode.OK, typeof(GetAutotopupConfigurationResponse))]
[SwaggerResponse((int)HttpStatusCode.BadRequest, typeof(ErrorResponse), BadRequestMessage)]
[SwaggerResponse((int)HttpStatusCode.Unauthorized, typeof(ErrorResponse), InvalidCredentiasMessage)]
[SwaggerResponse((int)HttpStatusCode.Forbidden, typeof(ErrorResponse), UserNoRightsMessage)]
[SwaggerResponse((int)HttpStatusCode.NotFound, typeof(ErrorResponse), AutopopupNotFoundMessage)]
[SwaggerResponse((int)HttpStatusCode.InternalServerError, typeof(ErrorResponse), InternalServerErrorMessage)]
如何简化逻辑并减少代码量或以某种方式使其更灵活?
【问题讨论】:
-
如果有机会将他们分组试试这个stackoverflow.com/questions/38503146/…
标签: c# .net asp.net-mvc asp.net-web-api swagger