fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
Apache License 2.0
2.6k stars 139 forks source link

(fix, openapi): Handle more `allow-multiple` oneOf cases #3830

Closed amckinney closed 3 months ago

amckinney commented 3 months ago

This updates the OpenAPI parser to better handle query parameters that can either be a single element or a list of elements. For example,

{
  "in": "query",
  "name": "user_id",
  "schema": {
    "anyOf": [
      {
        "type": "string"
      },
      {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    ]
  }
}

For now, we special case this so that we set the allow-multiple field so that the caller will always be able to set multiple elements (in the explode format).