OpenAPITools / OpenAPITools/openapi-generator

[BUG][typescript-angular] using --model-name-prefix: if model name starts with the passed prefix, the file name is incorrect

Open
#4,397 4 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

Description

When generating code, I'm passing the --model-name-prefix "I" option in my command. This is generating all my models with the prefix 'I'.
This is working fine for all my models except 1.
The name of the model is Invoice and the generated model in code is IInvoice. This is correct, but the generated file is 'nvoice.ts'. It seems that in this case, the i is dropped from my filename. This gives an error, because in the generated service file, the import is as follows:
import { IInvoice } from '../model/invoice'

openapi-generator version

version 4.2.0

Steps to reproduce

Generate a model which has a name starting with the same letter as the --model-name-prefix value

Suggest a fix

generated filename should be: invoice.ts

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 reproducing the TypeScript Angular generation with version 4.2.0, --model-name-prefix "I", and a model named Invoice. Inspect the generated model filename and service import; done means the model is written as invoice.ts and the generated import resolves correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, 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.