Skip to content

Commit c8f8744

Browse files
authored
docs: add cross-references to CLI reference documentation in various markdown files (#2678)
1 parent 0857ae7 commit c8f8744

17 files changed

Lines changed: 100 additions & 2 deletions

docs/aliases.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,7 @@ class Root(BaseModel):
107107
- The `ClassName` in scoped format must match the generated Python class name (after title conversion)
108108
- When using `--use-title-as-name`, the class name is derived from the `title` property in the schema
109109
- Aliases are applied during code generation, so the original field names are preserved as Pydantic `alias` values for proper serialization/deserialization
110+
111+
## See Also
112+
113+
- [CLI Reference: `--aliases`](cli-reference/field-customization.md#aliases) - Detailed CLI option documentation with examples

docs/cli-reference/field-customization.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ Apply custom field and class name aliases from JSON file.
3434
The `--aliases` option allows renaming fields and classes via a JSON mapping file,
3535
providing fine-grained control over generated names independent of schema definitions.
3636

37+
!!! tip "See Also"
38+
For detailed explanation and examples, see [Field Aliases](../aliases.md).
39+
3740
!!! tip "Usage"
3841

3942
```bash
@@ -853,6 +856,9 @@ The `--field-constraints` flag generates Pydantic Field() definitions with
853856
validation constraints (min/max length, pattern, etc.) from the schema.
854857
Output differs between Pydantic v1 and v2 due to API changes.
855858

859+
!!! tip "See Also"
860+
For detailed explanation and mypy compatibility, see [Field Constraints](../field-constraints.md).
861+
856862
!!! tip "Usage"
857863

858864
```bash

docs/cli-reference/general-options.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,9 @@ The `--generate-pyproject-config` flag outputs a pyproject.toml configuration
13891389
snippet based on the provided CLI arguments. This is useful for converting
13901390
a working CLI command into a reusable configuration file.
13911391

1392+
!!! tip "See Also"
1393+
For pyproject.toml configuration guide, see [pyproject.toml Configuration](../pyproject_toml.md).
1394+
13921395
!!! tip "Usage"
13931396

13941397
```bash
@@ -1595,6 +1598,9 @@ The `--ignore-pyproject` flag tells datamodel-codegen to ignore any
15951598
when you want to override project defaults with CLI arguments, or when
15961599
testing without project configuration.
15971600

1601+
!!! tip "See Also"
1602+
For pyproject.toml configuration guide, see [pyproject.toml Configuration](../pyproject_toml.md).
1603+
15981604
!!! tip "Usage"
15991605

16001606
```bash

docs/cli-reference/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ This documentation is auto-generated from test cases.
44

55
**[Quick Reference](quick-reference.md)** - All options on one page for Ctrl+F search
66

7+
## Related Documentation
8+
9+
| Topic | Description |
10+
|-------|-------------|
11+
| [Generate from OpenAPI](../openapi.md) | OpenAPI schema generation guide |
12+
| [Generate from JSON Schema](../jsonschema.md) | JSON Schema generation guide |
13+
| [Generate from GraphQL](../graphql.md) | GraphQL schema generation guide |
14+
| [pyproject.toml Configuration](../pyproject_toml.md) | File-based configuration |
15+
| [Custom Templates](../custom_template.md) | Jinja2 template customization |
16+
| [Field Aliases](../aliases.md) | Field renaming with aliases |
17+
| [Root Models and Type Aliases](../root-model-and-type-alias.md) | Type alias generation |
18+
719
## Categories
820

921
| Category | Options | Description |

docs/cli-reference/openapi-only-options.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# OpenAPI-only Options
22

3+
!!! info "Related Documentation"
4+
For OpenAPI usage guide and examples, see [Generate from OpenAPI](../openapi.md).
5+
36
## Options
47

58
| Option | Description |

docs/cli-reference/template-customization.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,9 @@ as a module path (e.g., "mymodule.formatter_function"). This is useful for
471471
adding custom comments, modifying code structure, or applying project-specific
472472
formatting rules beyond what black/isort provide.
473473

474+
!!! tip "See Also"
475+
For detailed explanation and examples, see [Custom Code Formatters](../custom-formatters.md).
476+
474477
!!! tip "Usage"
475478

476479
```bash
@@ -605,6 +608,9 @@ to override the default templates used for generating data models. This enables
605608
the generated code structure and formatting. Use with `--extra-template-data` to pass additional data
606609
to the templates.
607610

611+
!!! tip "See Also"
612+
For detailed explanation and examples, see [Custom Templates](../custom_template.md).
613+
608614
!!! tip "Usage"
609615

610616
```bash
@@ -1921,6 +1927,9 @@ the generated Python code. Available formatters are: black, isort,
19211927
ruff, yapf, autopep8, autoflake. Default is [black, isort].
19221928
Use this to customize formatting or disable formatters entirely.
19231929

1930+
!!! tip "See Also"
1931+
For built-in formatting configuration, see [Formatting](../formatting.md).
1932+
19241933
!!! tip "Usage"
19251934

19261935
```bash

docs/cli-reference/typing-customization.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,6 +1826,9 @@ syntax. This feature is experimental.
18261826

18271827
**Related:** [`--target-python-version`](model-customization.md#target-python-version)
18281828

1829+
!!! tip "See Also"
1830+
For detailed explanation and examples, see [Root Models and Type Aliases](../root-model-and-type-alias.md).
1831+
18291832
!!! tip "Usage"
18301833

18311834
```bash

docs/custom-formatters.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ and run the following command
2121
```sh
2222
$ datamodel-codegen --input {your_input_file} --output {your_output_file} --custom-formatters "{path_to_your_module}.your_module"
2323
```
24+
25+
## See Also
26+
27+
- [CLI Reference: `--custom-formatters`](cli-reference/template-customization.md#custom-formatters) - Detailed CLI option documentation
28+
- [CLI Reference: `--custom-formatters-kwargs`](cli-reference/template-customization.md#custom-formatters-kwargs) - Pass arguments to custom formatters
29+
- [Formatting](formatting.md) - Built-in code formatting with black and isort

docs/custom_template.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,8 @@ class Model(BaseModel):
5858
```
5959

6060
In this example, we kept it simple, but you can create more complex custom templates by copying [the default templates](https://github.com/koxudaxi/datamodel-code-generator/tree/main/src/datamodel_code_generator/model/template) Use [the default templates](https://github.com/koxudaxi/datamodel-code-generator/tree/main/src/datamodel_code_generator/model/template) as a reference for understanding the structure and available variables, and customize the code generation process according to your specific requirements.
61+
62+
## See Also
63+
64+
- [CLI Reference: `--custom-template-dir`](cli-reference/template-customization.md#custom-template-dir) - Detailed CLI option documentation
65+
- [CLI Reference: `--extra-template-data`](cli-reference/template-customization.md#extra-template-data) - Pass custom variables to templates

docs/field-constraints.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,9 @@ $ mypy model.py
8989
Success: no issues found in 1 source file
9090
```
9191

92+
## See Also
93+
94+
- [CLI Reference: `--field-constraints`](cli-reference/field-customization.md#field-constraints) - Detailed CLI option documentation with examples
95+
9296
## Related issues
9397
[https://github.com/samuelcolvin/pydantic/issues/156](https://github.com/samuelcolvin/pydantic/issues/156)

0 commit comments

Comments
 (0)