OpenAPITools / OpenAPITools/openapi-generator

[BUG] typescript-node generates invalid code for 'api-key'

Open
#3,794 5 comments 0 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
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • [x<] What's the version of OpenAPI Generator used? 4.1.1
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
Description
  1. Download the following file https://directory-te.preta.eu/directory/static/directory/api/tppSwaggerApi.json
  2. Run openapi-generator generate -i tppSwaggerApi.json -g typescript-node

Result: An invalid enum is generated.


// ===============================================
// This file is autogenerated - Please do not edit
// ===============================================

export enum TppApiApiKeys {
    api-key,
}

Also, for some reason the response type is using response: http.ClientResponse which does not seem to work. When changed to response: localVarRequest.Response everything works as expected.

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 by running openapi-generator generate -i tppSwaggerApi.json -g typescript-node with the linked specification and inspect the generated TppApiApiKeys enum and response type. Trace the typescript-node generation path for these outputs; done means the generated enum is valid TypeScript and the response type works without manual changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.