swagger-api / swagger-api/swagger-codegen-generators
"pipeDelimeted" query parameter format generates invalid node-fetch code
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
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"]);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the typescript-fetch generator templates responsible for COLLECTION_FORMATS and query serialization, then inspect how pipeDelimited is mapped and referenced. Generate code from the example schema and verify that the resulting TypeScript compiles without the invalid COLLECTION_FORMATS["pipe"] access.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100