Skip to content

Commit a3fc339

Browse files
docs: sync generated docs
1 parent dbf394e commit a3fc339

2 files changed

Lines changed: 283 additions & 0 deletions

File tree

docs/llms-full.txt

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,17 @@ This documentation is auto-generated from test cases.
11251125
| ⚙️ [General Options](general-options.md) | 18 | Utilities and meta options |
11261126
| 📝 [Utility Options](utility-options.md) | 10 | Help, version, debug options |
11271127

1128+
## 🎯 Focused Topics
1129+
1130+
Use these pages when you know the workflow area but not the exact option name.
1131+
1132+
| Topic | Options | Groups |
1133+
|-------|---------|--------|
1134+
| [Model Customization](topics/model-customization.md) | 23 | Model Naming, Model Reuse, Model Shape, Root Model |
1135+
| [Template Customization](topics/template-customization.md) | 19 | Custom Templates, Generated Output, Imports, Output Formatting |
1136+
| [Typing Customization](topics/typing-customization.md) | 20 | Imports, Collection Types, Type Alias, Type Mapping, Type Syntax |
1137+
| [OpenAPI](topics/openapi.md) | 7 | OpenAPI Naming, OpenAPI Paths, OpenAPI Scopes, Read Only Write Only |
1138+
11281139
## All Options
11291140

11301141
**Jump to:** [A](#a) · [B](#b) · [C](#c) · [D](#d) · [E](#e) · [F](#f) · [G](#g) · [H](#h) · [I](#i) · [K](#k) · [L](#l) · [M](#m) · [N](#n) · [O](#o) · [P](#p) · [R](#r) · [S](#s) · [T](#t) · [U](#u) · [V](#v) · [W](#w)
@@ -28087,6 +28098,271 @@ Displays the installed version of datamodel-code-generator.
2808728098

2808828099
---
2808928100

28101+
# Model Customization
28102+
28103+
Source: https://datamodel-code-generator.koxudaxi.dev/cli-reference/topics/model-customization/
28104+
28105+
Choose model class shape, naming, reuse, and root-model behavior.
28106+
28107+
Options are grouped from shared CLI metadata and link back to their generated reference sections.
28108+
28109+
## Groups
28110+
28111+
| Group | Options | Description |
28112+
|-------|---------|-------------|
28113+
| [Model Naming](#model-naming) | 9 | Class names, suffixes, prefixes, and duplicate-name behavior. |
28114+
| [Model Reuse](#model-reuse) | 4 | Schema deduplication and shared generated modules. |
28115+
| [Model Shape](#model-shape) | 6 | Output model family and compatibility targets. |
28116+
| [Root Model](#root-model) | 4 | Root model creation, collapse, and alias behavior. |
28117+
28118+
## Model Naming {#model-naming}
28119+
28120+
Class names, suffixes, prefixes, and duplicate-name behavior.
28121+
28122+
| Option | Description |
28123+
|--------|-------------|
28124+
| [`--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. |
28125+
| [`--class-name`](../model-customization.md#class-name) | Override the auto-generated class name with a custom name. |
28126+
| [`--class-name-affix-scope`](../model-customization.md#class-name-affix-scope) | Control which classes receive the prefix/suffix. |
28127+
| [`--class-name-prefix`](../model-customization.md#class-name-prefix) | Add a prefix to all generated class names. |
28128+
| [`--class-name-suffix`](../model-customization.md#class-name-suffix) | Add a suffix to all generated class names. |
28129+
| [`--duplicate-name-suffix`](../model-customization.md#duplicate-name-suffix) | Customize suffix for duplicate model names. |
28130+
| [`--model-name-map`](../model-customization.md#model-name-map) | Rename generated model classes from a JSON mapping. |
28131+
| [`--naming-strategy`](../model-customization.md#naming-strategy) | Use parent-prefixed naming strategy for duplicate model names. |
28132+
| [`--parent-scoped-naming`](../model-customization.md#parent-scoped-naming) | Namespace models by their parent scope to avoid naming conflicts. |
28133+
28134+
## Model Reuse {#model-reuse}
28135+
28136+
Schema deduplication and shared generated modules.
28137+
28138+
| Option | Description |
28139+
|--------|-------------|
28140+
| [`--collapse-reuse-models`](../model-customization.md#collapse-reuse-models) | Collapse duplicate models by replacing references instead of inheritance. |
28141+
| [`--reuse-model`](../model-customization.md#reuse-model) | Reuse identical model definitions instead of generating duplicates. |
28142+
| [`--reuse-scope`](../model-customization.md#reuse-scope) | Scope for model reuse detection (root or tree). |
28143+
| [`--shared-module-name`](../general-options.md#shared-module-name) | Customize the name of the shared module for deduplicated models. |
28144+
28145+
## Model Shape {#model-shape}
28146+
28147+
Output model family and compatibility targets.
28148+
28149+
| Option | Description |
28150+
|--------|-------------|
28151+
| [`--base-class`](../model-customization.md#base-class) | Specify a custom base class for generated models. |
28152+
| [`--base-class-map`](../model-customization.md#base-class-map) | Specify different base classes for specific models via JSON mapping. |
28153+
| [`--output-model-type`](../model-customization.md#output-model-type) | Select the output model type (Pydantic v2, Pydantic v2 dataclass, dataclasses, T... |
28154+
| [`--target-pydantic-version`](../model-customization.md#target-pydantic-version) | Target Pydantic version for generated code compatibility. |
28155+
| [`--target-python-version`](../model-customization.md#target-python-version) | Target Python version for generated code syntax and imports. |
28156+
| [`--use-generic-base-class`](../model-customization.md#use-generic-base-class) | Generate a shared base class with model configuration to avoid repetition (DRY). |
28157+
28158+
## Root Model {#root-model}
28159+
28160+
Root model creation, collapse, and alias behavior.
28161+
28162+
| Option | Description |
28163+
|--------|-------------|
28164+
| [`--collapse-root-models`](../model-customization.md#collapse-root-models) | Inline root model definitions instead of creating separate wrapper classes. |
28165+
| [`--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. |
28166+
| [`--skip-root-model`](../model-customization.md#skip-root-model) | Skip generation of root model when schema contains nested definitions. |
28167+
| [`--use-root-model-sequence-interface`](../model-customization.md#use-root-model-sequence-interface) | Make non-null sequence-like Pydantic v2 RootModel classes implement collections.... |
28168+
28169+
---
28170+
28171+
# Template Customization
28172+
28173+
Source: https://datamodel-code-generator.koxudaxi.dev/cli-reference/topics/template-customization/
28174+
28175+
Tune generated file headers, imports, decorators, templates, and formatting.
28176+
28177+
Options are grouped from shared CLI metadata and link back to their generated reference sections.
28178+
28179+
## Groups
28180+
28181+
| Group | Options | Description |
28182+
|-------|---------|-------------|
28183+
| [Custom Templates](#custom-templates) | 3 | Custom templates and extra template data. |
28184+
| [Generated Output](#generated-output) | 7 | Generated file headers and reproducible output. |
28185+
| [Imports](#imports) | 4 | Generated imports and type-checking import behavior. |
28186+
| [Output Formatting](#output-formatting) | 5 | Formatter selection, quote style, and string wrapping. |
28187+
28188+
## Custom Templates {#custom-templates}
28189+
28190+
Custom templates and extra template data.
28191+
28192+
| Option | Description |
28193+
|--------|-------------|
28194+
| [`--custom-template-dir`](../template-customization.md#custom-template-dir) | Use custom Jinja2 templates for model generation. |
28195+
| [`--extra-template-data`](../template-customization.md#extra-template-data) | Pass custom template variables via inline JSON or a JSON file path. |
28196+
| [`--validators`](../template-customization.md#validators) | Add custom field validators to generated Pydantic v2 models. |
28197+
28198+
## Generated Output {#generated-output}
28199+
28200+
Generated file headers and reproducible output.
28201+
28202+
| Option | Description |
28203+
|--------|-------------|
28204+
| [`--class-decorators`](../template-customization.md#class-decorators) | Add custom decorators to generated model classes. |
28205+
| [`--custom-file-header`](../template-customization.md#custom-file-header) | Add custom header text to the generated file. |
28206+
| [`--custom-file-header-path`](../template-customization.md#custom-file-header-path) | Add custom header content from file to generated code. |
28207+
| [`--disable-timestamp`](../template-customization.md#disable-timestamp) | Disable timestamp in generated file header for reproducible output. |
28208+
| [`--enable-command-header`](../template-customization.md#enable-command-header) | Include command-line options in file header for reproducibility. |
28209+
| [`--enable-generated-header-marker`](../template-customization.md#enable-generated-header-marker) | Include the @generated marker in file header for generated-code tooling. |
28210+
| [`--enable-version-header`](../template-customization.md#enable-version-header) | Include tool version information in file header. |
28211+
28212+
## Imports {#imports}
28213+
28214+
Generated imports and type-checking import behavior.
28215+
28216+
| Option | Description |
28217+
|--------|-------------|
28218+
| [`--additional-imports`](../template-customization.md#additional-imports) | Add custom imports to generated output files. |
28219+
| [`--no-use-type-checking-imports`](../template-customization.md#no-use-type-checking-imports) | Keep generated model imports available at runtime when using Ruff fixes. |
28220+
| [`--use-exact-imports`](../template-customization.md#use-exact-imports) | Import exact types instead of modules. |
28221+
| [`--use-type-checking-imports`](../template-customization.md#use-type-checking-imports) | Allow Ruff to move typing-only imports into TYPE_CHECKING blocks. |
28222+
28223+
## Output Formatting {#output-formatting}
28224+
28225+
Formatter selection, quote style, and string wrapping.
28226+
28227+
| Option | Description |
28228+
|--------|-------------|
28229+
| [`--custom-formatters`](../template-customization.md#custom-formatters) | Apply custom Python code formatters to generated output. |
28230+
| [`--custom-formatters-kwargs`](../template-customization.md#custom-formatters-kwargs) | Pass custom arguments to custom formatters via inline JSON or a JSON file path. |
28231+
| [`--formatters`](../template-customization.md#formatters) | Specify code formatters to apply to generated output. |
28232+
| [`--use-double-quotes`](../template-customization.md#use-double-quotes) | Use double quotes for string literals in generated code. |
28233+
| [`--wrap-string-literal`](../template-customization.md#wrap-string-literal) | Wrap long string literals across multiple lines. |
28234+
28235+
---
28236+
28237+
# Typing Customization
28238+
28239+
Source: https://datamodel-code-generator.koxudaxi.dev/cli-reference/topics/typing-customization/
28240+
28241+
Control Python annotation syntax, collection types, imports, and type mappings.
28242+
28243+
Options are grouped from shared CLI metadata and link back to their generated reference sections.
28244+
28245+
## Groups
28246+
28247+
| Group | Options | Description |
28248+
|-------|---------|-------------|
28249+
| [Imports](#imports) | 1 | Generated imports and type-checking import behavior. |
28250+
| [Collection Types](#collection-types) | 5 | Collection and tuple/set generation. |
28251+
| [Type Alias](#type-alias) | 2 | TypeAlias and root-model alias output. |
28252+
| [Type Mapping](#type-mapping) | 9 | Scalar, date/time, and custom type mapping. |
28253+
| [Type Syntax](#type-syntax) | 3 | Modern annotation syntax and Annotated usage. |
28254+
28255+
## Imports {#imports}
28256+
28257+
Generated imports and type-checking import behavior.
28258+
28259+
| Option | Description |
28260+
|--------|-------------|
28261+
| [`--disable-future-imports`](../typing-customization.md#disable-future-imports) | Prevent automatic addition of __future__ imports in generated code. |
28262+
28263+
## Collection Types {#collection-types}
28264+
28265+
Collection and tuple/set generation.
28266+
28267+
| Option | Description |
28268+
|--------|-------------|
28269+
| [`--no-use-standard-collections`](../typing-customization.md#no-use-standard-collections) | Use typing.Dict/List instead of built-in dict/list for container types. |
28270+
| [`--use-generic-container-types`](../typing-customization.md#use-generic-container-types) | Use generic container types (Sequence, Mapping) for type hinting. |
28271+
| [`--use-standard-collections`](../typing-customization.md#use-standard-collections) | Use built-in dict/list instead of typing.Dict/List. |
28272+
| [`--use-tuple-for-fixed-items`](../typing-customization.md#use-tuple-for-fixed-items) | Generate tuple types for arrays with items array syntax. |
28273+
| [`--use-unique-items-as-set`](../typing-customization.md#use-unique-items-as-set) | Generate set types for arrays with uniqueItems constraint. |
28274+
28275+
## Type Alias {#type-alias}
28276+
28277+
TypeAlias and root-model alias output.
28278+
28279+
| Option | Description |
28280+
|--------|-------------|
28281+
| [`--use-root-model-type-alias`](../typing-customization.md#use-root-model-type-alias) | Generate RootModel as type alias format for better mypy support. |
28282+
| [`--use-type-alias`](../typing-customization.md#use-type-alias) | Use TypeAlias instead of root models for type definitions (experimental). |
28283+
28284+
## Type Mapping {#type-mapping}
28285+
28286+
Scalar, date/time, and custom type mapping.
28287+
28288+
| Option | Description |
28289+
|--------|-------------|
28290+
| [`--output-date-class`](../typing-customization.md#output-date-class) | Specify date class type for date schema fields. |
28291+
| [`--output-datetime-class`](../typing-customization.md#output-datetime-class) | Specify datetime class type for date-time schema fields. |
28292+
| [`--strict-types`](../typing-customization.md#strict-types) | Enable strict type validation for specified Python types. |
28293+
| [`--type-mappings`](../typing-customization.md#type-mappings) | Override default type mappings for schema formats. |
28294+
| [`--type-overrides`](../typing-customization.md#type-overrides) | Replace schema model types with custom Python types via JSON mapping. |
28295+
| [`--use-decimal-for-multiple-of`](../typing-customization.md#use-decimal-for-multiple-of) | Generate Decimal types for fields with multipleOf constraint. |
28296+
| [`--use-object-type`](../typing-customization.md#use-object-type) | Use object instead of Any for unspecified object and array values. |
28297+
| [`--use-pendulum`](../typing-customization.md#use-pendulum) | Use pendulum types for date, time, and duration fields. |
28298+
| [`--use-standard-primitive-types`](../typing-customization.md#use-standard-primitive-types) | Use Python standard library types for string formats instead of str. |
28299+
28300+
## Type Syntax {#type-syntax}
28301+
28302+
Modern annotation syntax and Annotated usage.
28303+
28304+
| Option | Description |
28305+
|--------|-------------|
28306+
| [`--no-use-union-operator`](../typing-customization.md#no-use-union-operator) | Use Union\[X, Y\] / Optional\[X\] instead of X \| Y union operator. |
28307+
| [`--use-annotated`](../typing-customization.md#use-annotated) | Use typing.Annotated for Field() with constraints. |
28308+
| [`--use-union-operator`](../typing-customization.md#use-union-operator) | Use \| operator for Union types (PEP 604). |
28309+
28310+
---
28311+
28312+
# OpenAPI
28313+
28314+
Source: https://datamodel-code-generator.koxudaxi.dev/cli-reference/topics/openapi/
28315+
28316+
Handle OpenAPI operation naming, path selection, scopes, and readOnly/writeOnly behavior.
28317+
28318+
Options are grouped from shared CLI metadata and link back to their generated reference sections.
28319+
28320+
## Groups
28321+
28322+
| Group | Options | Description |
28323+
|-------|---------|-------------|
28324+
| [OpenAPI Naming](#openapi-naming) | 2 | Operation and response model naming. |
28325+
| [OpenAPI Paths](#openapi-paths) | 2 | Path selection and path parameter output. |
28326+
| [OpenAPI Scopes](#openapi-scopes) | 1 | OpenAPI generation scopes. |
28327+
| [Read Only Write Only](#read-only-write-only) | 2 | readOnly/writeOnly model behavior. |
28328+
28329+
## OpenAPI Naming {#openapi-naming}
28330+
28331+
Operation and response model naming.
28332+
28333+
| Option | Description |
28334+
|--------|-------------|
28335+
| [`--use-operation-id-as-name`](../openapi-only-options.md#use-operation-id-as-name) | Use OpenAPI operationId as the generated function/class name. |
28336+
| [`--use-status-code-in-response-name`](../openapi-only-options.md#use-status-code-in-response-name) | Include HTTP status code in response model names. |
28337+
28338+
## OpenAPI Paths {#openapi-paths}
28339+
28340+
Path selection and path parameter output.
28341+
28342+
| Option | Description |
28343+
|--------|-------------|
28344+
| [`--include-path-parameters`](../openapi-only-options.md#include-path-parameters) | Include OpenAPI path parameters in generated parameter models. |
28345+
| [`--openapi-include-paths`](../openapi-only-options.md#openapi-include-paths) | Filter OpenAPI paths to include in model generation. |
28346+
28347+
## OpenAPI Scopes {#openapi-scopes}
28348+
28349+
OpenAPI generation scopes.
28350+
28351+
| Option | Description |
28352+
|--------|-------------|
28353+
| [`--openapi-scopes`](../openapi-only-options.md#openapi-scopes) | Specify OpenAPI scopes to generate (schemas, paths, parameters). |
28354+
28355+
## Read Only Write Only {#read-only-write-only}
28356+
28357+
readOnly/writeOnly model behavior.
28358+
28359+
| Option | Description |
28360+
|--------|-------------|
28361+
| [`--read-only-write-only-model-type`](../openapi-only-options.md#read-only-write-only-model-type) | Generate separate request and response models for readOnly/writeOnly fields. |
28362+
| [`--use-frozen-field`](../model-customization.md#use-frozen-field) | Generate frozen (immutable) field definitions for readOnly properties. |
28363+
28364+
---
28365+
2809028366
# Quick Reference
2809128367

2809228368
Source: https://datamodel-code-generator.koxudaxi.dev/cli-reference/quick-reference/

docs/llms.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
- [GraphQL-only Options](https://datamodel-code-generator.koxudaxi.dev/cli-reference/graphql-only-options/)
1818
- [General Options](https://datamodel-code-generator.koxudaxi.dev/cli-reference/general-options/)
1919
- [Utility Options](https://datamodel-code-generator.koxudaxi.dev/cli-reference/utility-options/)
20+
### Focused Topics
21+
22+
- [Model Customization](https://datamodel-code-generator.koxudaxi.dev/cli-reference/topics/model-customization/): Choose model class shape, naming, reuse, and root-model behavior.
23+
- [Template Customization](https://datamodel-code-generator.koxudaxi.dev/cli-reference/topics/template-customization/): Tune generated file headers, imports, decorators, templates, and formatting.
24+
- [Typing Customization](https://datamodel-code-generator.koxudaxi.dev/cli-reference/topics/typing-customization/): Control Python annotation syntax, collection types, imports, and type mappings.
25+
- [OpenAPI](https://datamodel-code-generator.koxudaxi.dev/cli-reference/topics/openapi/): Handle OpenAPI operation naming, path selection, scopes, and readOnly/writeOnly behavior.
26+
2027
- [Quick Reference](https://datamodel-code-generator.koxudaxi.dev/cli-reference/quick-reference/): All CLI options in one page for easy **Ctrl+F** searching.
2128
### Manual
2229

0 commit comments

Comments
 (0)