swagger-typescript-api icon indicating copy to clipboard operation
swagger-typescript-api copied to clipboard

Query params of type array are not generated as array

Open JiProchazka opened this issue 2 years ago • 1 comments

Hi,

when the query param is an array it does not get generated as array.

Example of swagger.json

"/api/integrations/{id}/files": {
  "get": {
  "tags": [
    "integration-file-controller"
  ],
  "summary": "getIntegrationFiles",
  "description": "Returns a integration file list (pageable).",
  "operationId": "getIntegrationFilesGET",
  "produces": [
    "application/json",
    "application/xml"
  ],
  "parameters": [
  {
    "name": "fileTypes",
    "in": "query",
    "description": "File types",
    "required": false,
    "type": "array",
    "items": {
      "type": "string",
      "enum": [
        "RESOURCE",
        "ROUTE",
        "PROPERTIES",
      ]
  },
  "collectionFormat": "multi",
  "enum": [
    "RESOURCE",
    "ROUTE",
    "PROPERTIES"
  ]
},

Output

but the generated query is not an array:

getIntegrationFilesGet: (
      query?: {
        /** File types */
        fileTypes?: GetIntegrationFilesGetParamsFileTypes;

Expected output:

getIntegrationFilesGet: (
      query?: {
        /** File types */
        fileTypes?: Array<GetIntegrationFilesGetParamsFileTypes>;

Thanks

JiProchazka avatar Apr 28 '23 05:04 JiProchazka

Same issue here, any chance you have a workaround or fix?

M1sterPl0w avatar Nov 24 '23 15:11 M1sterPl0w