I have a Search method in my API controller. It is a GET request with input parameter of Dictionary keyValuePairs.
Code is something like this.
[Route("Search")]
[HttpGet]
public IHttpActionResult Search( Dictionary<string, string> keyValuePairs)
{
IDictionary<string, object> resultDict = new Dictionary<string, object>();
var keyValueParameters = this.Url.Request.GetQueryNameValuePairs();
//Do bunch of things with keyValueParameters and fill up resultDict
return Ok(resultDict);
}
Help page is as follow.
Where you can see Body Parameters in Request Information but not for Response Information. Shouldn't it be other way around for GET. I am sure I need to handle this little differently given dictionaries involved but not able to figure it out.
It seems like the Helper pages are using pretty common ApiExplorer package. I did not try it myself but you can add something like this to your code to make it understand what is the correct response there:
[ProducesResponseType(type: typeof(IDictionary<string, object>), statusCode: StatusCodes.Status200OK)]
public IHttpActionResult Search( Dictionary<string, string> keyValuePairs)