OpenAPITools / OpenAPITools/openapi-generator
[BUG] If ignore to generate specific models in .openapi-generator-ignore, the model.ts file will still import the un-existing files
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
The request model is written in typescript
- 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
type exampleRequest = {
status: 'success';
details: string;
} | {
status: 'failed':
errors: string
}
OpenApi generated 3 models with exampleRequest, exampleRequestOneOf and exampleRequestOneOf2, Since we already have the model type imported, so I added these 3 files in .openapi-generator-ignore file to not generate
/model/exampleRequestOneOf1ts
/model/exampleRequestOneOf1.ts
also added exampleRequest in openapi.config.json in importMapping.
"importMappings": {
"exampleRequest": "@foo-service/request"
}
The OpenApi didn't do the generation, however, the model.ts file still import them, but they are not existing since never generated.
openapi-generator version
3.0.2
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
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 with the TypeScript generation path that produces model.ts, then inspect how .openapi-generator-ignore and the openapi.config.json importMappings are applied. Reproduce the issue with the described request union and ignored model files. Done means model.ts does not import model files that were not generated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100