|
| 1 | +# Model Customization |
| 2 | + |
| 3 | +Choose model class shape, naming, reuse, and root-model behavior. |
| 4 | + |
| 5 | +Options are grouped from shared CLI metadata and link back to their generated reference sections. |
| 6 | + |
| 7 | +## Groups |
| 8 | + |
| 9 | +| Group | Options | Description | |
| 10 | +|-------|---------|-------------| |
| 11 | +| [Model Naming](#model-naming) | 9 | Class names, suffixes, prefixes, and duplicate-name behavior. | |
| 12 | +| [Model Reuse](#model-reuse) | 4 | Schema deduplication and shared generated modules. | |
| 13 | +| [Model Shape](#model-shape) | 6 | Output model family and compatibility targets. | |
| 14 | +| [Root Model](#root-model) | 4 | Root model creation, collapse, and alias behavior. | |
| 15 | + |
| 16 | +## Model Naming {#model-naming} |
| 17 | + |
| 18 | +Class names, suffixes, prefixes, and duplicate-name behavior. |
| 19 | + |
| 20 | +| Option | Description | |
| 21 | +|--------|-------------| |
| 22 | +| [`--allow-leading-underscore-class-name`](../model-customization.md#allow-leading-underscore-class-name) | Allow an explicitly specified root class name to start with an underscore. | |
| 23 | +| [`--class-name`](../model-customization.md#class-name) | Override the auto-generated class name with a custom name. | |
| 24 | +| [`--class-name-affix-scope`](../model-customization.md#class-name-affix-scope) | Control which classes receive the prefix/suffix. | |
| 25 | +| [`--class-name-prefix`](../model-customization.md#class-name-prefix) | Add a prefix to all generated class names. | |
| 26 | +| [`--class-name-suffix`](../model-customization.md#class-name-suffix) | Add a suffix to all generated class names. | |
| 27 | +| [`--duplicate-name-suffix`](../model-customization.md#duplicate-name-suffix) | Customize suffix for duplicate model names. | |
| 28 | +| [`--model-name-map`](../model-customization.md#model-name-map) | Rename generated model classes from a JSON mapping. | |
| 29 | +| [`--naming-strategy`](../model-customization.md#naming-strategy) | Use parent-prefixed naming strategy for duplicate model names. | |
| 30 | +| [`--parent-scoped-naming`](../model-customization.md#parent-scoped-naming) | Namespace models by their parent scope to avoid naming conflicts. | |
| 31 | + |
| 32 | +## Model Reuse {#model-reuse} |
| 33 | + |
| 34 | +Schema deduplication and shared generated modules. |
| 35 | + |
| 36 | +| Option | Description | |
| 37 | +|--------|-------------| |
| 38 | +| [`--collapse-reuse-models`](../model-customization.md#collapse-reuse-models) | Collapse duplicate models by replacing references instead of inheritance. | |
| 39 | +| [`--reuse-model`](../model-customization.md#reuse-model) | Reuse identical model definitions instead of generating duplicates. | |
| 40 | +| [`--reuse-scope`](../model-customization.md#reuse-scope) | Scope for model reuse detection (root or tree). | |
| 41 | +| [`--shared-module-name`](../general-options.md#shared-module-name) | Customize the name of the shared module for deduplicated models. | |
| 42 | + |
| 43 | +## Model Shape {#model-shape} |
| 44 | + |
| 45 | +Output model family and compatibility targets. |
| 46 | + |
| 47 | +| Option | Description | |
| 48 | +|--------|-------------| |
| 49 | +| [`--base-class`](../model-customization.md#base-class) | Specify a custom base class for generated models. | |
| 50 | +| [`--base-class-map`](../model-customization.md#base-class-map) | Specify different base classes for specific models via JSON mapping. | |
| 51 | +| [`--output-model-type`](../model-customization.md#output-model-type) | Select the output model type (Pydantic v2, Pydantic v2 dataclass, dataclasses, T... | |
| 52 | +| [`--target-pydantic-version`](../model-customization.md#target-pydantic-version) | Target Pydantic version for generated code compatibility. | |
| 53 | +| [`--target-python-version`](../model-customization.md#target-python-version) | Target Python version for generated code syntax and imports. | |
| 54 | +| [`--use-generic-base-class`](../model-customization.md#use-generic-base-class) | Generate a shared base class with model configuration to avoid repetition (DRY). | |
| 55 | + |
| 56 | +## Root Model {#root-model} |
| 57 | + |
| 58 | +Root model creation, collapse, and alias behavior. |
| 59 | + |
| 60 | +| Option | Description | |
| 61 | +|--------|-------------| |
| 62 | +| [`--collapse-root-models`](../model-customization.md#collapse-root-models) | Inline root model definitions instead of creating separate wrapper classes. | |
| 63 | +| [`--collapse-root-models-name-strategy`](../model-customization.md#collapse-root-models-name-strategy) | Select which name to keep when collapsing root models with object references. | |
| 64 | +| [`--skip-root-model`](../model-customization.md#skip-root-model) | Skip generation of root model when schema contains nested definitions. | |
| 65 | +| [`--use-root-model-sequence-interface`](../model-customization.md#use-root-model-sequence-interface) | Make non-null sequence-like Pydantic v2 RootModel classes implement collections.... | |
0 commit comments