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

Split output with multiple configurations

Open kenjiqq opened this issue 3 months ago • 0 comments

Description

With the new multiple configurations feature where you can pass in an array of specification files to input would it be possible for this to generate types for each of the input files in separate outputted type.gen files, probably a type folder with all the different files. Assuming an input like

{
        input: [
            "news.yaml",
            "comments.yaml",
        ],
}

you could for instance generate

types/news.types.gen.ts
types/comments.types.gen.ts

Once you have a lot of input files it feels like this would be cleaner then having everything in the same file.

Currently it has to prefix all the types with the filename to avoid conflict, separate output files would remove the need for this since: Instead of import { CommentsCommentsResponse } from 'types.gen'; you would have import { CommentsResponse } from 'types/comments.types.gen';

Before this feature was added you had the workaround of running the generator multiple times on different spec files, and this would be a more similar structure to what they would currently be using from that.

I used types as the example here but you have the same for the sdk generation etc as well.

kenjiqq avatar Oct 10 '25 13:10 kenjiqq