[BUG][typescript-axios] 'isCollectionFormatMulti' flag not being set to true on multiple file uploads
Created by: BrMtssk
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I have the exact use case as described on #7247 (closed) for uploading multiple files, but apparently the 'isCollectionFormatMulti' is not set to 'true' on those cases and therefore the generator still handle those parameters as strings.
openapi-generator version
Latest master (3de53706)
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: test
version: "1.0.0"
tags:
- name: test
description: test
servers:
- url: http://localhost:3000
paths:
/api/upload:
post:
tags: []
operationId: upload files
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
message:
type: string
files:
type: array
items:
type: string
format: binary
required:
- message
responses:
200:
description: ok
Generation Details
openapi-generator-cli.jar generate -i foo.yaml -g typescript-axios -o foo
Steps to reproduce
Generate the client via the above command. Verify that the output contains the following lines:
if (files) {
localVarFormParams.append(files.join(COLLECTION_FORMATS.csv));
}
The desired output should be
if (files) {
files.forEach((element) => {
localVarFormParams.append('files', element as any);
})
}
Related issues/PRs
#7247 (closed) #7814
Suggest a fix
Correctly set the flag to true on postProcessParameter
. I am going to submit a PR addressing it.