I'm working on an endpoint which looks like this:
GET {{url}}/v1.0/GroupsInfo/StuffToGet/1/2/hea
where the 2 integers are certain ids and the text on the end is a search term.
I want the last parameter (the search text) to be optional. I have got that working using the following, but it does not appear as mandatory in Swagger:
[Route("[action]/{catId:int}/{dogId:int}/{search?}")]
public IActionResult StuffToGet(int catId, int dogId, string search)
{
// do stuff
}
Swagger is ignoring the question mark on the end of the Search parameter in the route constraint.
Is this a known issue, or do I need to right some custom code to get Swagger to recognise that optional flag?