'Generating explode: false for array query parameters in swagger.json using openapi 3.0.1 and .Net Core 3.1 and Swashbucle.AspNetCore.SwaggerGen

I am developing some Openapi 3.0.1 APIs with .Net Core 3.1 using Swashbuckle.AspNetCore.Swagger and SwaggerGen v6.1.4. I want to build an API that receives an array query parameter; in ASP.NET Core the default call for an API like this is something like

https://someUrl/?values=valore1&values=valore2

but due to caller needs I want to accept something simpler, like

https://someUrl/?values=valore1,valore2

In other words, I want to generate a swagger.json that has an explode: false node

  parameters:
    - name: values
      in: query
      explode: false
      schema:
        type: array
        items:
          type: string

while the default is explode: true.

How can I do this? Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source