0

I am using NSwag to generate Swagger documentation for my API. One of my API endpoints uses a Dictionary<string, string>, but in the Swagger UI, it is displayed as a generic object. Instead of a single object text box, I want a control that allows me to input key-value pairs for the dictionary.

  [HttpPost]
    [Route("/api/students/{id:guid}")]
    public async Task<IActionResult> ExecuteSparqlAsync(Guid Id, [FromQuery] IDictionary<string,string> queries)
    {
        return Ok();
    }

Here is the generated swagger UI enter image description here

When I use a List instead of a Dictionary, the generated Swagger UI looks like the image below:

enter image description here

How can I configure NSwag to properly display the Dictionary<string, string> in the Swagger UI?

0

Browse other questions tagged or ask your own question.