mnahkies / openapi-code-generator

A code generation tool for openapi 3 / 3.1 specifications written in typescript, primarily aimed at generating typescript clients and server stubs. Other target languages may be added in future.
https://openapi-code-generator.nahkies.co.nz/
MIT License
17 stars 2 forks source link

feat: experimental support for splitting code by tags / route segments #134

Closed mnahkies closed 6 months ago

mnahkies commented 6 months ago

introduces a new experimental option --grouping-strategy used by the typescript-koa template to split the routes into separate files, based on either their first tag or route segment.

includes a lot of refactoring to support this:

there's still quite a bit of impedance mismatch that makes outputting in different ways like this more challenging than it would ideally be, mainly that we go straight from IRModel -> string and quickly loose context of that string (eg: what imports it depends on, where it is used)

eventually we'll probably need to introduce some wrapping object, similar to the CompilationUnit introduced in this change that can track interesting things and allow us to be smarter about how we organize the resulting files.