Bug Report Checklist
Description
If uniqueItems is true for an array, the typescript-fetch generator uses a Set instead of an array. This does not work for query parameters however, because the querystring function does not support Sets:
|
export function querystring(params: HTTPQuery, prefix: string = ''): string { |
|
return Object.keys(params) |
|
.map((key) => { |
|
const fullKey = prefix + (prefix.length ? `[${key}]` : key); |
|
const value = params[key]; |
|
if (value instanceof Array) { |
|
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) |
|
.join(`&${encodeURIComponent(fullKey)}=`); |
|
return `${encodeURIComponent(fullKey)}=${multiValue}`; |
|
} |
|
if (value instanceof Date) { |
|
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`; |
|
} |
|
if (value instanceof Object) { |
|
return querystring(value as HTTPQuery, fullKey); |
|
} |
|
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; |
|
}) |
|
.filter(part => part.length > 0) |
|
.join('&'); |
|
} |
)
openapi-generator version
master
Bug Report Checklist
Description
If
uniqueItemsis true for an array, the typescript-fetch generator uses a Set instead of an array. This does not work for query parameters however, because the querystring function does not support Sets:openapi-generator/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache
Lines 256 to 276 in 8d4c9e2
openapi-generator version
master