Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #4159
Closed
Open
Issue created Oct 15, 2019 by Administrator@rootContributor

[BUG] [typescript-rxjs] Typescript error in generated files for query parameters

Created by: balazs-zsoldos

Description

In case Typescript strict mode is on, there is typescript error in the generated code if a function has one or more query parameters.

openapi-generator version

4.0.3 - 4.1.3

OpenAPI declaration file content or url

The standard petstore yaml file that is used to generate the samples.

Command line used for generation

See the samples directory for the generated files.

Steps to reproduce
  • Download the typescript-rxjs/default (or any other) sample from the github master branch
  • Copy it into a project where typescript strict mode is on, or
  • Just open it in Visual Code to see the error in UserApi.ts loginUser function.

Generated code:

const query: HttpQuery = { ...(requestParameters.username && { 'username': requestParameters.username }), ...(requestParameters.password && { 'password': requestParameters.password }), };

Error message:

Type '{} | { 'username': string; } | { 'password': string; } | { 'password': string; 'username': string; }' is not assignable to type 'HttpQuery'. Type '{}' is not assignable to type 'HttpQuery'. Index signature is missing in type '{}'.

Related issues/PRs

none

Suggest a fix

The generated code was ok until 4.0.2. It would be good to check why the mustache files were changed to the new code.

Assignee
Assign to
Time tracking