swagger-api / swagger-api/swagger-codegen

[TypeScript-Inversify] Wrong variable used when generating collection query params

Open
#9,844 0 comments 0 reactions 1 assignee View on GitHub

@gracekarina is already working on this.

Since Apr 22, 2020.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The TypeScript-Inversify code generator generates wrong code for collection query parameters. It iterates over the collection and appends the whole collection itself instead of the current element.

Swagger-codegen version

Using swagger hub.

Suggest a fix/enhancement

Currently in "modules/swagger-codegen/src/main/resources/typescript-inversify/api.service.mustache" on line 66 the code is
{{#isCollectionFormatMulti}} {{paramName}}.forEach((element) => { queryParameters.push('{{paramName}}='+encodeURIComponent(String({{paramName}}))); }) {{/isCollectionFormatMulti}}

It should be
{{#isCollectionFormatMulti}} {{paramName}}.forEach((element) => { queryParameters.push('{{paramName}}='+encodeURIComponent(String({{element}}))); }) {{/isCollectionFormatMulti}}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.