OpenAPITools / OpenAPITools/openapi-generator

[BUG] Typescript - Multiple imports missing comma

Open
#7,156 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug Report Checklist
Description

The following yaml file has multiple instances where two exports are import into the same file:
eg:

import { this that } from "./example.ts";

Problem being, the comma is missing in the above example, for instance the correctly generated code should be:

import { this, that } from "./example.ts";
openapi-generator version

Latest npm version

Steps to reproduce
  1. Download the code snippet above in the description
  2. npx @openapitools/openapi-generator-cli generate -i beacon-node-oapi.yaml -g typescript-node -o ./generated-source
  3. Navigate to generated-typescript/api/beaconApi.ts line 37.
    You should see:
import { String  AnyType } from '../model/string  AnyType';

There are other instances of this, but this one stands out.

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

Run the provided openapi-generator command against beacon-node-oapi.yaml and inspect generated-typescript/api/beaconApi.ts around line 37. Trace the TypeScript generator or template responsible for imports; done means generated imports contain commas between multiple names, including the String and AnyType example.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.