OpenAPITools / OpenAPITools/openapi-generator
[BUG] angular ts -> imports to models in generated code are wrong when using modelSuffix
Nobody has claimed this yet.
- 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)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When using generator-cli version 6.2.0 instead of 5.4.0 the imports to the models are wrong when using a modelSuffix.
Version 6.2.0 (wrong)
import { TestUserTest } from '../model/testUserTest';
Version 5.4.0 (correct)
import { TestUserTest } from '../model/testUser';
The imports to the models have the modelSuffix in the File name, which is wrong
openapi-generator version
6.2.0
OpenAPI declaration file and settings
interface-test.json:
{
"npmName": "apiTest",
"npmVersion": "0.0.1",
"taggedUnions": true,
"supportsES6": true,
"ensureUniqueParams": false,
"api-name-suffix": "Test",
"modelSuffix": "Test",
"fileNaming": "camelCase",
"useSingleRequestParameter": true
}
OpenApi definition.json:
https://gist.github.com/alfredJune/0d118a3a6d9bbf83c9df32a32fde490c
Steps to reproduce
- generate: npx openapi-generator-cli generate -g typescript-angular -c ./test/interface-test.json -i ./test/definition.json -o ./test/generated
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the documented npx openapi-generator-cli command with test/interface-test.json and test/definition.json, then inspect the generated TypeScript Angular imports and model filenames. Done means generated imports reference the model files without modelSuffix, while the reported model names remain correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- api, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100