OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Having an issue with importMappings when generating a typescript-node client. However, this looks like an issue in the DefaultGenerator so I wanted to bring up here:
If I use this OpenAPI PetStore Spec to generate the client and I assume I have all the types defined in a library called @company/prefix-zoo-store, the generated client correct recognizes a single model in the importMapping but if I have more than one, it shows an interesting log in the generation and:
Creates the model for the type which import model specified
Does not import either the model from the generated or the import mapping in the client which it created.
import { Pet, Pets, Error } from '@company/prefix-zoo-store';
Actual
Here is the log in the generation:
[main] INFO o.o.codegen.TemplateManager - Skipped /local/src/model/@company/prefix-zoo-store.ts (Skipped prior to model processing due to import mapping conflict (either by user or by generator).)
[main] INFO o.o.codegen.TemplateManager - Skipped /local/src/model/@company/prefix-zoo-store.ts (Skipped prior to model processing due to import mapping conflict (either by user or by generator).)
Bug Report Checklist
Description
Having an issue with
importMappings
when generating a typescript-node client. However, this looks like an issue in the DefaultGenerator so I wanted to bring up here: If I use this OpenAPI PetStore Spec to generate the client and I assume I have all the types defined in a library called@company/prefix-zoo-store
, the generated client correct recognizes a single model in theimportMapping
but if I have more than one, it shows an interesting log in the generation and: Creates the model for the type which import model specified Does not import either the model from the generated or the import mapping in the client which it created.Some
openapi-generator version
v5-beta2
OpenAPI declaration file content or url
https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml
Generation Details
openapi.config.json
is :Expected
Actual
The import section of the client only has:
Fix
The error seems to arise from https://github.com/OpenAPITools/openapi-generator/blame/41851b45e1f1ffa7f0df36270a6b3c0cee6425bb/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java#L442