Skip to content

Template Customization

Tune generated file headers, imports, decorators, templates, and formatting.

Options are grouped from shared CLI metadata and link back to their generated reference sections.

Groups

Group Options Description
Custom Templates 3 Custom templates and extra template data.
Generated Output 7 Generated file headers and reproducible output.
Imports 4 Generated imports and type-checking import behavior.
Output Formatting 5 Formatter selection, quote style, and string wrapping.

Custom Templates

Custom templates and extra template data.

Option Description
--custom-template-dir Use custom Jinja2 templates for model generation.
--extra-template-data Pass custom template variables via inline JSON or a JSON file path.
--validators Add custom field validators to generated Pydantic v2 models.

Generated Output

Generated file headers and reproducible output.

Option Description
--class-decorators Add custom decorators to generated model classes.
--custom-file-header Add custom header text to the generated file.
--custom-file-header-path Add custom header content from file to generated code.
--disable-timestamp Disable timestamp in generated file header for reproducible output.
--enable-command-header Include command-line options in file header for reproducibility.
--enable-generated-header-marker Include the @generated marker in file header for generated-code tooling.
--enable-version-header Include tool version information in file header.

Imports

Generated imports and type-checking import behavior.

Option Description
--additional-imports Add custom imports to generated output files.
--no-use-type-checking-imports Keep generated model imports available at runtime when using Ruff fixes.
--use-exact-imports Import exact types instead of modules.
--use-type-checking-imports Allow Ruff to move typing-only imports into TYPE_CHECKING blocks.

Output Formatting

Formatter selection, quote style, and string wrapping.

Option Description
--custom-formatters Apply custom Python code formatters to generated output.
--custom-formatters-kwargs Pass custom arguments to custom formatters via inline JSON or a JSON file path.
--formatters Specify code formatters to apply to generated output.
--use-double-quotes Use double quotes for string literals in generated code.
--wrap-string-literal Wrap long string literals across multiple lines.