datamodel-code-generator
datamodel-code-generator copied to clipboard
Is it possible to generate one file per generated model?
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
Seems like a duplicate of #1170