OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.23k stars 6.43k forks source link

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

Open thomas-lucas1985 opened 4 years ago

thomas-lucas1985 commented 4 years ago
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

auto-labeler[bot] commented 4 years ago

👍 Thanks for opening this issue! 🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

macjohnny commented 4 years ago

Would you like to implement a fix for this?

thomas-lucas1985 commented 4 years ago

Would you like to implement a fix for this?

Hi @macjohnny

We're using the codegen for professional reasons and at the time being, we're quite on a tight schedule. I'm affraid I'm not familiar with the project and I'm lacking the time to get familiar. So I would prefer not.

Thanks

macjohnny commented 4 years ago

if anyone wants to fix this, I think the problem is here https://github.com/OpenAPITools/openapi-generator/blob/9a1ff9bf051221c5e53ba811052e1a4e16c40bef/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java#L593-L608