openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[REQ] Support Import mappings in typescript client generator

Open uesyn opened this issue 4 years ago • 0 comments

Is your feature request related to a problem? Please describe.

I just can't get the import mappings to work in typescript client generator. It works in typescript-node, but doesn't work in typescript. The import maps are completely ignored.

How to reproduce

$ java -jar ./modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g typescript --import-mappings=Tag="../../types" -o out -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml
  • out/models/Pet.ts

got:

import { Category } from './Category';
import { Tag } from './Tag';
import { HttpFile } from '../http/http';

want:

import { Category } from './Category';
import { Tag } from '../../types';
import { HttpFile } from '../http/http';

Describe the solution you'd like

As far as I confirmed, it is not implemented for typescript client generator, so I hope that it is implemented in typescript client generator.

Describe alternatives you've considered

After code generated, copy custom models to ./{modelFilename} which is wrong imported path.

Additional context

similar to https://github.com/OpenAPITools/openapi-generator/issues/10887

uesyn avatar Jul 18 '22 09:07 uesyn