practical-api-guidelines icon indicating copy to clipboard operation
practical-api-guidelines copied to clipboard

Include validation errors in swagger documentation?

Open pietersap opened this issue 6 years ago • 3 comments

Each controller can also return a validation error, status code 400. Should we also include this in the swagger documentation, for completeness? In a similar way that the OK200 and ERROR500 status codes are documented here below.

        [HttpGet(Name = Constants.RouteNames.v1.GetCustomizations)]
        [SwaggerResponse((int)HttpStatusCode.OK, "List of players")]
        [SwaggerResponse((int)HttpStatusCode.InternalServerError, "API is not available")]
        public async Task<IActionResult> GetCustomizations()

pietersap avatar Mar 19 '19 16:03 pietersap

Imo, yes.

fgheysels avatar Mar 22 '19 15:03 fgheysels

probably we should update the guidance of the Level 1 saying that for every implemented status code, a swagger response attribute should be added.

MassimoC avatar Mar 22 '19 16:03 MassimoC

Agreed

pietersap avatar Mar 22 '19 16:03 pietersap