Skip to content

[typescript-fetch] Remove barrel imports #12081

@orrin-naylor-instacart

Description

@orrin-naylor-instacart

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

At instacart we are power users of openapi-generator. We have thousands of files in the /models directory.
Because of the barrel imports, importing one file from models or apis imports everything from models or apis.
EG

import {
  GetAdminProductMappingRequestsParamData,
  GetAdminProductMappingRequestsParamDataFromJSON,
  GetAdminProductMappingRequestsParamDataFromJSONTyped,
} from './' // This imports the index.ts file, which imports than exports everything (AKA barrel import)

Parsing all that typescript causes our tests to run significantly slower. We've experimented with manually removing the barrel imports. Which resulted in a ~3x speedup. Individual test ran in 12s rather than 33s.

Describe the solution you'd like

I'd like to add a --noBarrelImports flag to the generator

Describe alternatives you've considered

We tried creating our own .mustache templates. And it worked! It'd be nice to it have built in, so we can continue to get updates and bug fixes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions