swagger-api / swagger-api/swagger-codegen
collectionFormat 'pipes' is not properly handled in generated code
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
The code is using 'pipe' to encode the array argument, while the corresponding COLLECTION_FORMAT constant is 'pipes'
content in base.ts:
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
usage in code:
if (usernames) {
localVarQueryParameter['usernames'] = usernames.join(COLLECTION_FORMATS.pipe);
}
Swagger-codegen version
3.0.25
Swagger declaration file content or url
"/chat/client/list": {
"get": {
"tags": [
"client-controller"
],
"operationId": "findAllClients",
"parameters": [
{
"name": "usernames",
"in": "query",
"required": false,
"style": "pipeDelimited",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
]
}
}
Command line used for generation
language=typescript-axios (generated with swagger-codgen-maven-plugin(v3)
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
Start with the TypeScript Axios generator output and the base.ts content shown in the issue, then reproduce generation using the provided pipeDelimited array parameter. Trace where the collection format is selected and verify the generated code uses the matching constant for pipe-delimited values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100