datamodel-code-generator
datamodel-code-generator copied to clipboard
Ability to add custom formatters
Is your feature request related to a problem? Please describe.
Currently I'm trying to workaround some problem described before, so I created some really strange template with imports but generator also adds some imports which are not used anymore. So I would like to remove those unused imports with for example autoflake
(because isort/black cannot do this atm and looks like it will never be their ability).
Describe the solution you'd like The most variable solution is probably ability to add custom formatters (or in general scripts to be run after generation is completed). This could be configured easily in pyproject.toml like this
[tool.datamodel-codegen.formatter.autoflake]
executable = autoflake
args = --remove-unused-variables
Describe alternatives you've considered Creating own makefile target for this - combined running generator and then in next round running autoflake