fern icon indicating copy to clipboard operation
fern copied to clipboard

[Feature] Support OpenAPI3 "style" parameters in SDK generators

Open ashb opened this issue 1 year ago • 1 comments

There is a feature of OpenAPI 3 that lets you change the style of how repeated parameters are specified https://spec.openapis.org/oas/v3.0.3#parameterStyle and https://spec.openapis.org/oas/v3.0.3#style-examples

The particular use case I have is to set explode=false to have CSV parameters rather than multiple query params.

Minimal OpenAPI spec file:

{
  "info": {
    "title": "My API",
    "version": "1.0.0"
  },
  "openapi": "3.0.3",
  "paths": {
    "/test/": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "explode": false,
            "name": "parameter",
            "required": true,
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  }
}

When called with multiple params this should result in ?parameter=a,b,c but it always/only produces ?parameter=a&parameter=b&parameter=c.

I've checked the python and Go SDK generators, and neither handle these style parameters, so I assume this is a universal feature request, though specifically I'm exploring Go, Python and Typescript generators.

ashb avatar Mar 28 '24 09:03 ashb

@ashb thanks for the issue! I'll pull this forward from our backlog and see where we can slot it in. Will keep you updated here!

dannysheridan avatar Jun 09 '24 15:06 dannysheridan