OpenAPITools / OpenAPITools/openapi-generator
[BUG][Typescript Angular] Broken imports with 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
The import paths of models are broken when the option --modelSuffix is used.
// Generated e.g. with v6.2.1
import { InlineResponse200178MyTestApi } from '../model/inlineResponse200178MyTestApi'; // broken
But the file ../model/inlineResponse200178MyTestApi doesn't exists. The file name has no suffix.
//Generated with v7.0.0 (openapi-generator-cli-7.0.0-20221012.083708-4.jar)
import { InlineResponse200178MyTestApi } from '../model/inlineResponse200178'; // expected
Since you already fixed it in the new major version is there any chance that this bug could be fixed also in 6.x?
openapi-generator version
All versions >= 5.2 and < 7.0.0
OpenAPI declaration file content or url
Reproducible e.g. with https://app.swaggerhub.com/apis/binance_api/BinanceSpotAPI/1.0#/Market/get_api_v3_trades
Generation Details
$ openapi-generator-cli generate -i binance_api-BinanceSpotAPI-1.0-resolved.json -g typescript-angular -o my-test-api/src --additional-properties apiModulePrefix=MyTest,configurationPrefix=MyTestApi,enumNameSuffix=MyTestApi,modelSuffix=MyTestApi,serviceSuffix=MyTestApiService --global-property skipFormModel=false
Steps to reproduce
Generate the linked api with the command above and check the imports in e.g. the file convert.service.ts.
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
Run the provided openapi-generator-cli command against the BinanceSpotAPI specification and inspect imports in convert.service.ts alongside the generated model filenames. Compare the typescript-angular output with and without modelSuffix, then confirm that every generated model import resolves to an existing file, including the 6.x output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100