OpenAPITools / OpenAPITools/openapi-generator

[BUG] TypeScript NestJS template uses URLSearchParams incorrectly

Open
#16,739 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Rather than trying to set a property on the URLSearchParams instance as seen below, it should call set.

https://github.com/OpenAPITools/openapi-generator/blob/effbe8caad70e8e4eb4bfa1dfbd9f7ba9bae94cb/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache#L89

Should be this:

queryParameters.set('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}']));

Also we need to import COLLECTION_FORMATS.

import { COLLECTION_FORMATS } from '../variables';

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.

Research direction

Start with modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache at the referenced line, then inspect the generated template's imports and query parameter handling. Update the template so collection parameters use URLSearchParams.set and COLLECTION_FORMATS is imported from ../variables; done when the generated TypeScript NestJS service contains both changes.

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
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.