datamodel-code-generator icon indicating copy to clipboard operation
datamodel-code-generator copied to clipboard

Is it possible to generate one file per generated model?

Open michaelgmiller1 opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. Our FastAPI startup time is slow due to initializing Pydantic models. A lot of this initialization time is in models that we do not use. Our datamodel-code-generator generated models contain many models which our code does not use.

Describe the solution you'd like Rather than output a single file containing all models, we would like to generate a directory of files, so that we can only import the models we need.

Describe alternatives you've considered We've thought about adding a subsequent model-stripping step on our side, but it would be better to not have to maintain this code.

Additional context n/a

michaelgmiller1 avatar Feb 20 '24 18:02 michaelgmiller1

Seems like a duplicate of #1170

nvachhar avatar May 23 '24 17:05 nvachhar