"pipeDelimeted" query parameter format generates invalid node-fetch code
Hi,
setting the style parameter of a query parameter to pipeDelimited generates invalid typescript-fetch code.
Example Property
- name: searchIn
in: query
description: Ids of the columns to search in
required: true
style: pipeDelimited
explode: false
schema:
type: array
items:
type: integer
api.ts(7404,87): error TS2551: Property 'pipe' does not exist on type '{ csv: string; ssv: string; tsv: string; pipes: string; }'. Did you mean 'pipes'?
Generated code
This is the generated COLLECTION_FORMATS object:
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
And this is the code that tries to access an invalid property of COLLECTION_FORMATS:
if (searchIn) {
localVarQueryParameter['searchIn'] = searchIn.join(COLLECTION_FORMATS["pipe"]);
}
If COLLECTION_FORMATS.pipes is to be renamed to COLLECTION_FORMATS.pipe, the fix should be made in https://github.com/swagger-api/swagger-codegen-generators/blob/master/src/main/resources/handlebars/typescript-fetch/api.mustache.
If the fix should be done in the generated code, I am unsure where to do that. I'd be happy to fix this and submit a PR if someone could give me a hint.
Edit: COLLECTION_FORMATS is accessed for query and header params:
{{^isCollectionFormatMulti}}
localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS["{{collectionFormat}}"]);
{{/isCollectionFormatMulti}}
To me it seems that another potential cause of this bug may be that collectionFormat is "pipe" but should actually be "pipes". Honestly I don't know what would be correct.
Edit 2: Seems like in the java code the collectionFormat is set to "pipe". I'll submit a PR with the template fixed.