December 2019
Intermediate to advanced
510 pages
11h 33m
English
The default response type of the Swagger UI produces some incorrect information. If we take a look at the responses section, we will see that the response code is incorrect and that it doesn't correspond with the actual HTTP code that's returned by the web service. When using ASP.NET Core 2.2 or later, it is possible to use conventions to specify the response types:
.. [ApiController] public class ItemController : ControllerBase { [HttpGet] [ApiConventionMethod(typeof(DefaultApiConventions), nameof(DefaultApiConventions.Get))] public async Task<IActionResult> Get([FromQuery] int pageSize = 10, [FromQuery] int pageIndex = 0) [HttpGet("{id:guid}")] [ApiConventionMethod(typeof(DefaultApiConventions ...
Read now
Unlock full access