I noticed, that my swagger index page, renders a mandatory field id
although I set in the code [HttpGet("{id?}")]
Here is the whole method:
/// <summary>
/// Returns all projects
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[ProducesDefaultResponseType]
[HttpGet("{id?}")]
public async Task<IActionResult> Get([FromRoute] int? id)
{
return Ok(await Mediator.Send(new GetProjectsQuery { Id = id }));
}
Where I went wrong?