# Presets

<!-- Generated by scripts/build_preset_docs.py. Do not edit manually. -->

Presets are immutable named groups of CLI options. A preset name never changes behavior; new recommendations are published as new dated preset names.

Every preset name includes its Python target, so generated Python syntax is pinned without an extra `--target-python-version` argument. Choose the preset name instead of adding a separate target option to normal preset commands; if an explicit target is already present in CLI or pyproject configuration, it must match the preset name.

See also: [CLI Reference](cli-reference/index.md), [`--preset`](cli-reference/base-options.md#preset), [`--target-python-version`](cli-reference/model-customization.md#target-python-version), [`--output-model-type`](cli-reference/model-customization.md#output-model-type), [`--profile`](cli-reference/utility-options.md#profile), [`--generate-pyproject-config`](cli-reference/general-options.md#generate-pyproject-config), [`--generate-cli-command`](cli-reference/general-options.md#generate-cli-command), [pyproject.toml configuration](pyproject_toml.md), and [CI/CD integration](ci-cd.md).

## Usage

Use a preset by passing its immutable name:

```bash
datamodel-codegen \
  --input schema.json \
  --input-file-type jsonschema \
  --output-model-type pydantic_v2.BaseModel \
  --preset standard-py312-20260619 \
  --output model.py
```

Use `standard-py312-20260619` for the project-recommended modern Python 3.12 baseline. Use `practical-py312-20260619` when you also want schema-authored names, model reuse, and schema descriptions embedded in the generated code.

## Override Preset Options

Preset options are defaults, not locks. Explicit options override preset-supplied values.

```bash
datamodel-codegen \
  --input schema.json \
  --preset standard-py312-20260619 \
  --no-snake-case-field \
  --no-use-annotated \
  --enum-field-as-literal none
```

Use documented `--no-*` options for boolean settings that support negation. For value options, pass the replacement value explicitly, such as `--enum-field-as-literal none`.

## Add Options On Top

You can add any normal CLI option to a preset command. This is the recommended way to start from a preset and make a project-specific choice:

```bash
datamodel-codegen \
  --input schema.json \
  --preset standard-py312-20260619 \
  --extra-fields forbid \
  --use-title-as-name \
  --output model.py
```

## Use Presets With Profiles

Presets can live in `[tool.datamodel-codegen]` or in a named profile. Profiles are useful when one repository generates several model sets:

```toml title="pyproject.toml"
[tool.datamodel-codegen]
output-model-type = "pydantic_v2.BaseModel"
preset = "standard-py312-20260619"

[tool.datamodel-codegen.profiles.api]
input = "schemas/api.json"
output = "src/models/api.py"
preset = "practical-py312-20260619"
extra-fields = "forbid"

[tool.datamodel-codegen.profiles.events]
input = "schemas/events.json"
output = "src/models/events.py"
use-title-as-name = true
```

```bash
datamodel-codegen --profile api
datamodel-codegen --profile events
```

If `--preset` is passed on the CLI, it overrides pyproject preset settings and pyproject options unless the same option is also explicit on the CLI. If `preset` is configured in `pyproject.toml`, pyproject/profile options and CLI options override preset-supplied values.

## Export Configuration

To convert a working preset command into `pyproject.toml`, use `--generate-pyproject-config`:

```bash
datamodel-codegen \
  --input schema.json \
  --output model.py \
  --output-model-type pydantic_v2.BaseModel \
  --preset practical-py312-20260619 \
  --extra-fields forbid \
  --generate-pyproject-config
```

To inspect the effective CLI command for an existing pyproject profile, use `--generate-cli-command`:

```bash
datamodel-codegen --profile api --generate-cli-command
```

Use `--ignore-pyproject` when you want to test a preset command without loading project configuration.

## Built-in Presets

### Target Matrix

| Python target | Standard preset | Practical preset |
|---------------|-----------------|------------------|
| 3.10 | `standard-py310-20260619` | `practical-py310-20260619` |
| 3.11 | `standard-py311-20260619` | `practical-py311-20260619` |
| 3.12 | `standard-py312-20260619` | `practical-py312-20260619` |
| 3.13 | `standard-py313-20260619` | `practical-py313-20260619` |
| 3.14 | `standard-py314-20260619` | `practical-py314-20260619` |

Each preset name includes its Python target. Do not add `--target-python-version` just to use a preset; only expanded configuration without `--preset` needs a separate target option.

### Preset Reference

### `standard-py310-20260619`

Recommended modern Python 3.10 output for new projects.

This immutable preset enables the project-recommended Python output style for new code targeting Python 3.10. It is output-model aware and keeps stdlib dataclass and TypedDict keys compatible with their input names.

- **Requires separate target Python version:** no
- **Target Python version:** 3.10

#### Included Options

These snippets show the equivalent expanded configuration without `--preset` for JSON Schema input, Pydantic v2 BaseModel output, and Python 3.10. Replace the input and output paths for your project.

=== "pyproject.toml"

    ```toml
    [tool.datamodel-codegen]
    allow-population-by-field-name = true
    collapse-root-models = true
    disable-timestamp = true
    enum-field-as-literal = "one"
    input = "schema.json"
    input-file-type = "jsonschema"
    output = "model.py"
    output-model-type = "pydantic_v2.BaseModel"
    set-default-enum-member = true
    snake-case-field = true
    strict-nullable = true
    target-python-version = "3.10"
    use-annotated = true
    use-frozen-field = true
    use-standard-collections = true
    use-subclass-enum = true
    use-union-operator = true
    ```

=== "CLI"

    ```bash
    datamodel-codegen --allow-population-by-field-name --collapse-root-models --disable-timestamp --enum-field-as-literal one --input schema.json --input-file-type jsonschema --output model.py --output-model-type pydantic_v2.BaseModel --set-default-enum-member --snake-case-field --strict-nullable --target-python-version 3.10 --use-annotated --use-frozen-field --use-standard-collections --use-subclass-enum --use-union-operator
    ```

| Scope | Options | Notes |
|-------|---------|-------|
| All output model types | `--use-standard-collections`, `--use-union-operator`, `--use-annotated`, `--enum-field-as-literal one`, `--use-subclass-enum`, `--collapse-root-models`, `--strict-nullable`, `--set-default-enum-member`, `--disable-timestamp` | Use built-in collection syntax, PEP 604 unions, Annotated constraints, single-value enum Literals, typed enum subclasses, enum-member defaults, inline root wrappers, schema-accurate nullability, and reproducible file headers. |
| Pydantic v2 BaseModel and dataclass output | `--snake-case-field`, `--allow-population-by-field-name`, `--use-frozen-field` | Generate Pythonic field names while preserving input aliases and readOnly immutability metadata. |
| msgspec Struct output | `--snake-case-field`, `--use-standard-primitive-types` | Generate Pythonic field names with aliases and stdlib primitive types for schema formats. |
| stdlib dataclass output | `--use-standard-primitive-types` | Use stdlib primitive types without renaming input keys because dataclasses do not carry aliases. |
| TypedDict output | `--use-standard-primitive-types`, `--use-frozen-field` | Use stdlib primitive types and ReadOnly metadata without renaming dictionary keys. |

### `standard-py311-20260619`

Recommended modern Python 3.11 output for new projects.

This immutable preset enables the project-recommended Python output style for new code targeting Python 3.11. It is output-model aware and keeps stdlib dataclass and TypedDict keys compatible with their input names.

- **Requires separate target Python version:** no
- **Target Python version:** 3.11

#### Included Options

These snippets show the equivalent expanded configuration without `--preset` for JSON Schema input, Pydantic v2 BaseModel output, and Python 3.11. Replace the input and output paths for your project.

=== "pyproject.toml"

    ```toml
    [tool.datamodel-codegen]
    allow-population-by-field-name = true
    collapse-root-models = true
    disable-timestamp = true
    enum-field-as-literal = "one"
    input = "schema.json"
    input-file-type = "jsonschema"
    output = "model.py"
    output-model-type = "pydantic_v2.BaseModel"
    set-default-enum-member = true
    snake-case-field = true
    strict-nullable = true
    target-python-version = "3.11"
    use-annotated = true
    use-frozen-field = true
    use-specialized-enum = true
    use-standard-collections = true
    use-subclass-enum = true
    use-union-operator = true
    ```

=== "CLI"

    ```bash
    datamodel-codegen --allow-population-by-field-name --collapse-root-models --disable-timestamp --enum-field-as-literal one --input schema.json --input-file-type jsonschema --output model.py --output-model-type pydantic_v2.BaseModel --set-default-enum-member --snake-case-field --strict-nullable --target-python-version 3.11 --use-annotated --use-frozen-field --use-specialized-enum --use-standard-collections --use-subclass-enum --use-union-operator
    ```

| Scope | Options | Notes |
|-------|---------|-------|
| All output model types | `--use-standard-collections`, `--use-union-operator`, `--use-annotated`, `--enum-field-as-literal one`, `--use-subclass-enum`, `--collapse-root-models`, `--strict-nullable`, `--set-default-enum-member`, `--disable-timestamp` | Use built-in collection syntax, PEP 604 unions, Annotated constraints, single-value enum Literals, typed enum subclasses, enum-member defaults, inline root wrappers, schema-accurate nullability, and reproducible file headers. |
| Python 3.11+ targets | `--use-specialized-enum` | Use StrEnum or IntEnum only when the selected target Python version supports it. |
| Pydantic v2 BaseModel and dataclass output | `--snake-case-field`, `--allow-population-by-field-name`, `--use-frozen-field` | Generate Pythonic field names while preserving input aliases and readOnly immutability metadata. |
| msgspec Struct output | `--snake-case-field`, `--use-standard-primitive-types` | Generate Pythonic field names with aliases and stdlib primitive types for schema formats. |
| stdlib dataclass output | `--use-standard-primitive-types` | Use stdlib primitive types without renaming input keys because dataclasses do not carry aliases. |
| TypedDict output | `--use-standard-primitive-types`, `--use-frozen-field` | Use stdlib primitive types and ReadOnly metadata without renaming dictionary keys. |

### `standard-py312-20260619`

Recommended modern Python 3.12 output for new projects.

This immutable preset enables the project-recommended Python output style for new code targeting Python 3.12. It is output-model aware and keeps stdlib dataclass and TypedDict keys compatible with their input names.

- **Requires separate target Python version:** no
- **Target Python version:** 3.12

#### Included Options

These snippets show the equivalent expanded configuration without `--preset` for JSON Schema input, Pydantic v2 BaseModel output, and Python 3.12. Replace the input and output paths for your project.

=== "pyproject.toml"

    ```toml
    [tool.datamodel-codegen]
    allow-population-by-field-name = true
    collapse-root-models = true
    disable-timestamp = true
    enum-field-as-literal = "one"
    input = "schema.json"
    input-file-type = "jsonschema"
    output = "model.py"
    output-model-type = "pydantic_v2.BaseModel"
    set-default-enum-member = true
    snake-case-field = true
    strict-nullable = true
    target-python-version = "3.12"
    use-annotated = true
    use-frozen-field = true
    use-specialized-enum = true
    use-standard-collections = true
    use-subclass-enum = true
    use-union-operator = true
    ```

=== "CLI"

    ```bash
    datamodel-codegen --allow-population-by-field-name --collapse-root-models --disable-timestamp --enum-field-as-literal one --input schema.json --input-file-type jsonschema --output model.py --output-model-type pydantic_v2.BaseModel --set-default-enum-member --snake-case-field --strict-nullable --target-python-version 3.12 --use-annotated --use-frozen-field --use-specialized-enum --use-standard-collections --use-subclass-enum --use-union-operator
    ```

| Scope | Options | Notes |
|-------|---------|-------|
| All output model types | `--use-standard-collections`, `--use-union-operator`, `--use-annotated`, `--enum-field-as-literal one`, `--use-subclass-enum`, `--collapse-root-models`, `--strict-nullable`, `--set-default-enum-member`, `--disable-timestamp` | Use built-in collection syntax, PEP 604 unions, Annotated constraints, single-value enum Literals, typed enum subclasses, enum-member defaults, inline root wrappers, schema-accurate nullability, and reproducible file headers. |
| Python 3.11+ targets | `--use-specialized-enum` | Use StrEnum or IntEnum only when the selected target Python version supports it. |
| Pydantic v2 BaseModel and dataclass output | `--snake-case-field`, `--allow-population-by-field-name`, `--use-frozen-field` | Generate Pythonic field names while preserving input aliases and readOnly immutability metadata. |
| msgspec Struct output | `--snake-case-field`, `--use-standard-primitive-types` | Generate Pythonic field names with aliases and stdlib primitive types for schema formats. |
| stdlib dataclass output | `--use-standard-primitive-types` | Use stdlib primitive types without renaming input keys because dataclasses do not carry aliases. |
| TypedDict output | `--use-standard-primitive-types`, `--use-frozen-field` | Use stdlib primitive types and ReadOnly metadata without renaming dictionary keys. |

### `standard-py313-20260619`

Recommended modern Python 3.13 output for new projects.

This immutable preset enables the project-recommended Python output style for new code targeting Python 3.13. It is output-model aware and keeps stdlib dataclass and TypedDict keys compatible with their input names.

- **Requires separate target Python version:** no
- **Target Python version:** 3.13

#### Included Options

These snippets show the equivalent expanded configuration without `--preset` for JSON Schema input, Pydantic v2 BaseModel output, and Python 3.13. Replace the input and output paths for your project.

=== "pyproject.toml"

    ```toml
    [tool.datamodel-codegen]
    allow-population-by-field-name = true
    collapse-root-models = true
    disable-timestamp = true
    enum-field-as-literal = "one"
    input = "schema.json"
    input-file-type = "jsonschema"
    output = "model.py"
    output-model-type = "pydantic_v2.BaseModel"
    set-default-enum-member = true
    snake-case-field = true
    strict-nullable = true
    target-python-version = "3.13"
    use-annotated = true
    use-frozen-field = true
    use-specialized-enum = true
    use-standard-collections = true
    use-subclass-enum = true
    use-union-operator = true
    ```

=== "CLI"

    ```bash
    datamodel-codegen --allow-population-by-field-name --collapse-root-models --disable-timestamp --enum-field-as-literal one --input schema.json --input-file-type jsonschema --output model.py --output-model-type pydantic_v2.BaseModel --set-default-enum-member --snake-case-field --strict-nullable --target-python-version 3.13 --use-annotated --use-frozen-field --use-specialized-enum --use-standard-collections --use-subclass-enum --use-union-operator
    ```

| Scope | Options | Notes |
|-------|---------|-------|
| All output model types | `--use-standard-collections`, `--use-union-operator`, `--use-annotated`, `--enum-field-as-literal one`, `--use-subclass-enum`, `--collapse-root-models`, `--strict-nullable`, `--set-default-enum-member`, `--disable-timestamp` | Use built-in collection syntax, PEP 604 unions, Annotated constraints, single-value enum Literals, typed enum subclasses, enum-member defaults, inline root wrappers, schema-accurate nullability, and reproducible file headers. |
| Python 3.11+ targets | `--use-specialized-enum` | Use StrEnum or IntEnum only when the selected target Python version supports it. |
| Pydantic v2 BaseModel and dataclass output | `--snake-case-field`, `--allow-population-by-field-name`, `--use-frozen-field` | Generate Pythonic field names while preserving input aliases and readOnly immutability metadata. |
| msgspec Struct output | `--snake-case-field`, `--use-standard-primitive-types` | Generate Pythonic field names with aliases and stdlib primitive types for schema formats. |
| stdlib dataclass output | `--use-standard-primitive-types` | Use stdlib primitive types without renaming input keys because dataclasses do not carry aliases. |
| TypedDict output | `--use-standard-primitive-types`, `--use-frozen-field` | Use stdlib primitive types and ReadOnly metadata without renaming dictionary keys. |

### `standard-py314-20260619`

Recommended modern Python 3.14 output for new projects.

This immutable preset enables the project-recommended Python output style for new code targeting Python 3.14. It is output-model aware and keeps stdlib dataclass and TypedDict keys compatible with their input names.

- **Requires separate target Python version:** no
- **Target Python version:** 3.14

#### Included Options

These snippets show the equivalent expanded configuration without `--preset` for JSON Schema input, Pydantic v2 BaseModel output, and Python 3.14. Replace the input and output paths for your project.

=== "pyproject.toml"

    ```toml
    [tool.datamodel-codegen]
    allow-population-by-field-name = true
    collapse-root-models = true
    disable-timestamp = true
    enum-field-as-literal = "one"
    input = "schema.json"
    input-file-type = "jsonschema"
    output = "model.py"
    output-model-type = "pydantic_v2.BaseModel"
    set-default-enum-member = true
    snake-case-field = true
    strict-nullable = true
    target-python-version = "3.14"
    use-annotated = true
    use-frozen-field = true
    use-specialized-enum = true
    use-standard-collections = true
    use-subclass-enum = true
    use-union-operator = true
    ```

=== "CLI"

    ```bash
    datamodel-codegen --allow-population-by-field-name --collapse-root-models --disable-timestamp --enum-field-as-literal one --input schema.json --input-file-type jsonschema --output model.py --output-model-type pydantic_v2.BaseModel --set-default-enum-member --snake-case-field --strict-nullable --target-python-version 3.14 --use-annotated --use-frozen-field --use-specialized-enum --use-standard-collections --use-subclass-enum --use-union-operator
    ```

| Scope | Options | Notes |
|-------|---------|-------|
| All output model types | `--use-standard-collections`, `--use-union-operator`, `--use-annotated`, `--enum-field-as-literal one`, `--use-subclass-enum`, `--collapse-root-models`, `--strict-nullable`, `--set-default-enum-member`, `--disable-timestamp` | Use built-in collection syntax, PEP 604 unions, Annotated constraints, single-value enum Literals, typed enum subclasses, enum-member defaults, inline root wrappers, schema-accurate nullability, and reproducible file headers. |
| Python 3.11+ targets | `--use-specialized-enum` | Use StrEnum or IntEnum only when the selected target Python version supports it. |
| Pydantic v2 BaseModel and dataclass output | `--snake-case-field`, `--allow-population-by-field-name`, `--use-frozen-field` | Generate Pythonic field names while preserving input aliases and readOnly immutability metadata. |
| msgspec Struct output | `--snake-case-field`, `--use-standard-primitive-types` | Generate Pythonic field names with aliases and stdlib primitive types for schema formats. |
| stdlib dataclass output | `--use-standard-primitive-types` | Use stdlib primitive types without renaming input keys because dataclasses do not carry aliases. |
| TypedDict output | `--use-standard-primitive-types`, `--use-frozen-field` | Use stdlib primitive types and ReadOnly metadata without renaming dictionary keys. |

### `practical-py310-20260619`

Standard Python 3.10 output plus practical naming, deduplication, and schema documentation.

This immutable preset extends `standard-py310-20260619` with options that make generated models easier to read and use in real projects. It favors schema-authored names, model reuse, and embedded schema documentation over the most conservative output-shape stability.

- **Requires separate target Python version:** no
- **Target Python version:** 3.10

#### Included Options

These snippets show the equivalent expanded configuration without `--preset` for JSON Schema input, Pydantic v2 BaseModel output, and Python 3.10. Replace the input and output paths for your project.

=== "pyproject.toml"

    ```toml
    [tool.datamodel-codegen]
    allow-population-by-field-name = true
    collapse-reuse-models = true
    collapse-root-models = true
    disable-timestamp = true
    enum-field-as-literal = "one"
    input = "schema.json"
    input-file-type = "jsonschema"
    naming-strategy = "primary-first"
    output = "model.py"
    output-model-type = "pydantic_v2.BaseModel"
    reuse-model = true
    set-default-enum-member = true
    snake-case-field = true
    strict-nullable = true
    target-python-version = "3.10"
    use-annotated = true
    use-default-kwarg = true
    use-field-description = true
    use-field-description-example = true
    use-frozen-field = true
    use-object-type = true
    use-schema-description = true
    use-single-line-docstring = true
    use-standard-collections = true
    use-subclass-enum = true
    use-title-as-name = true
    use-tuple-for-fixed-items = true
    use-union-operator = true
    use-unique-items-as-set = true
    ```

=== "CLI"

    ```bash
    datamodel-codegen --allow-population-by-field-name --collapse-reuse-models --collapse-root-models --disable-timestamp --enum-field-as-literal one --input schema.json --input-file-type jsonschema --naming-strategy primary-first --output model.py --output-model-type pydantic_v2.BaseModel --reuse-model --set-default-enum-member --snake-case-field --strict-nullable --target-python-version 3.10 --use-annotated --use-default-kwarg --use-field-description --use-field-description-example --use-frozen-field --use-object-type --use-schema-description --use-single-line-docstring --use-standard-collections --use-subclass-enum --use-title-as-name --use-tuple-for-fixed-items --use-union-operator --use-unique-items-as-set
    ```

| Scope | Options | Notes |
|-------|---------|-------|
| All output model types | `--use-standard-collections`, `--use-union-operator`, `--use-annotated`, `--enum-field-as-literal one`, `--use-subclass-enum`, `--collapse-root-models`, `--strict-nullable`, `--set-default-enum-member`, `--disable-timestamp` | Use built-in collection syntax, PEP 604 unions, Annotated constraints, single-value enum Literals, typed enum subclasses, enum-member defaults, inline root wrappers, schema-accurate nullability, and reproducible file headers. |
| Pydantic v2 BaseModel and dataclass output | `--snake-case-field`, `--allow-population-by-field-name`, `--use-frozen-field` | Generate Pythonic field names while preserving input aliases and readOnly immutability metadata. |
| msgspec Struct output | `--snake-case-field`, `--use-standard-primitive-types` | Generate Pythonic field names with aliases and stdlib primitive types for schema formats. |
| stdlib dataclass output | `--use-standard-primitive-types` | Use stdlib primitive types without renaming input keys because dataclasses do not carry aliases. |
| TypedDict output | `--use-standard-primitive-types`, `--use-frozen-field` | Use stdlib primitive types and ReadOnly metadata without renaming dictionary keys. |
| Practical model structure and names | `--reuse-model`, `--collapse-reuse-models`, `--use-title-as-name`, `--naming-strategy primary-first` | Deduplicate identical models without empty inheritance wrappers, prefer schema titles for class names, and keep primary definitions ahead of inline duplicate names. |
| Practical typing and defaults | `--use-default-kwarg`, `--use-object-type`, `--use-tuple-for-fixed-items`, `--use-unique-items-as-set`, `--use-single-line-docstring` | Render defaults explicitly, prefer object for unconstrained values, preserve fixed and unique arrays, and keep short docstrings concise. |
| Schema documentation | `--use-schema-description`, `--use-field-description`, `--use-field-description-example` | Preserve schema and field descriptions, including examples, in generated model documentation. |

### `practical-py311-20260619`

Standard Python 3.11 output plus practical naming, deduplication, and schema documentation.

This immutable preset extends `standard-py311-20260619` with options that make generated models easier to read and use in real projects. It favors schema-authored names, model reuse, and embedded schema documentation over the most conservative output-shape stability.

- **Requires separate target Python version:** no
- **Target Python version:** 3.11

#### Included Options

These snippets show the equivalent expanded configuration without `--preset` for JSON Schema input, Pydantic v2 BaseModel output, and Python 3.11. Replace the input and output paths for your project.

=== "pyproject.toml"

    ```toml
    [tool.datamodel-codegen]
    allow-population-by-field-name = true
    collapse-reuse-models = true
    collapse-root-models = true
    disable-timestamp = true
    enum-field-as-literal = "one"
    input = "schema.json"
    input-file-type = "jsonschema"
    naming-strategy = "primary-first"
    output = "model.py"
    output-model-type = "pydantic_v2.BaseModel"
    reuse-model = true
    set-default-enum-member = true
    snake-case-field = true
    strict-nullable = true
    target-python-version = "3.11"
    use-annotated = true
    use-default-kwarg = true
    use-field-description = true
    use-field-description-example = true
    use-frozen-field = true
    use-object-type = true
    use-schema-description = true
    use-single-line-docstring = true
    use-specialized-enum = true
    use-standard-collections = true
    use-subclass-enum = true
    use-title-as-name = true
    use-tuple-for-fixed-items = true
    use-union-operator = true
    use-unique-items-as-set = true
    ```

=== "CLI"

    ```bash
    datamodel-codegen --allow-population-by-field-name --collapse-reuse-models --collapse-root-models --disable-timestamp --enum-field-as-literal one --input schema.json --input-file-type jsonschema --naming-strategy primary-first --output model.py --output-model-type pydantic_v2.BaseModel --reuse-model --set-default-enum-member --snake-case-field --strict-nullable --target-python-version 3.11 --use-annotated --use-default-kwarg --use-field-description --use-field-description-example --use-frozen-field --use-object-type --use-schema-description --use-single-line-docstring --use-specialized-enum --use-standard-collections --use-subclass-enum --use-title-as-name --use-tuple-for-fixed-items --use-union-operator --use-unique-items-as-set
    ```

| Scope | Options | Notes |
|-------|---------|-------|
| All output model types | `--use-standard-collections`, `--use-union-operator`, `--use-annotated`, `--enum-field-as-literal one`, `--use-subclass-enum`, `--collapse-root-models`, `--strict-nullable`, `--set-default-enum-member`, `--disable-timestamp` | Use built-in collection syntax, PEP 604 unions, Annotated constraints, single-value enum Literals, typed enum subclasses, enum-member defaults, inline root wrappers, schema-accurate nullability, and reproducible file headers. |
| Python 3.11+ targets | `--use-specialized-enum` | Use StrEnum or IntEnum only when the selected target Python version supports it. |
| Pydantic v2 BaseModel and dataclass output | `--snake-case-field`, `--allow-population-by-field-name`, `--use-frozen-field` | Generate Pythonic field names while preserving input aliases and readOnly immutability metadata. |
| msgspec Struct output | `--snake-case-field`, `--use-standard-primitive-types` | Generate Pythonic field names with aliases and stdlib primitive types for schema formats. |
| stdlib dataclass output | `--use-standard-primitive-types` | Use stdlib primitive types without renaming input keys because dataclasses do not carry aliases. |
| TypedDict output | `--use-standard-primitive-types`, `--use-frozen-field` | Use stdlib primitive types and ReadOnly metadata without renaming dictionary keys. |
| Practical model structure and names | `--reuse-model`, `--collapse-reuse-models`, `--use-title-as-name`, `--naming-strategy primary-first` | Deduplicate identical models without empty inheritance wrappers, prefer schema titles for class names, and keep primary definitions ahead of inline duplicate names. |
| Practical typing and defaults | `--use-default-kwarg`, `--use-object-type`, `--use-tuple-for-fixed-items`, `--use-unique-items-as-set`, `--use-single-line-docstring` | Render defaults explicitly, prefer object for unconstrained values, preserve fixed and unique arrays, and keep short docstrings concise. |
| Schema documentation | `--use-schema-description`, `--use-field-description`, `--use-field-description-example` | Preserve schema and field descriptions, including examples, in generated model documentation. |

### `practical-py312-20260619`

Standard Python 3.12 output plus practical naming, deduplication, and schema documentation.

This immutable preset extends `standard-py312-20260619` with options that make generated models easier to read and use in real projects. It favors schema-authored names, model reuse, and embedded schema documentation over the most conservative output-shape stability.

- **Requires separate target Python version:** no
- **Target Python version:** 3.12

#### Included Options

These snippets show the equivalent expanded configuration without `--preset` for JSON Schema input, Pydantic v2 BaseModel output, and Python 3.12. Replace the input and output paths for your project.

=== "pyproject.toml"

    ```toml
    [tool.datamodel-codegen]
    allow-population-by-field-name = true
    collapse-reuse-models = true
    collapse-root-models = true
    disable-timestamp = true
    enum-field-as-literal = "one"
    input = "schema.json"
    input-file-type = "jsonschema"
    naming-strategy = "primary-first"
    output = "model.py"
    output-model-type = "pydantic_v2.BaseModel"
    reuse-model = true
    set-default-enum-member = true
    snake-case-field = true
    strict-nullable = true
    target-python-version = "3.12"
    use-annotated = true
    use-default-kwarg = true
    use-field-description = true
    use-field-description-example = true
    use-frozen-field = true
    use-object-type = true
    use-schema-description = true
    use-single-line-docstring = true
    use-specialized-enum = true
    use-standard-collections = true
    use-subclass-enum = true
    use-title-as-name = true
    use-tuple-for-fixed-items = true
    use-union-operator = true
    use-unique-items-as-set = true
    ```

=== "CLI"

    ```bash
    datamodel-codegen --allow-population-by-field-name --collapse-reuse-models --collapse-root-models --disable-timestamp --enum-field-as-literal one --input schema.json --input-file-type jsonschema --naming-strategy primary-first --output model.py --output-model-type pydantic_v2.BaseModel --reuse-model --set-default-enum-member --snake-case-field --strict-nullable --target-python-version 3.12 --use-annotated --use-default-kwarg --use-field-description --use-field-description-example --use-frozen-field --use-object-type --use-schema-description --use-single-line-docstring --use-specialized-enum --use-standard-collections --use-subclass-enum --use-title-as-name --use-tuple-for-fixed-items --use-union-operator --use-unique-items-as-set
    ```

| Scope | Options | Notes |
|-------|---------|-------|
| All output model types | `--use-standard-collections`, `--use-union-operator`, `--use-annotated`, `--enum-field-as-literal one`, `--use-subclass-enum`, `--collapse-root-models`, `--strict-nullable`, `--set-default-enum-member`, `--disable-timestamp` | Use built-in collection syntax, PEP 604 unions, Annotated constraints, single-value enum Literals, typed enum subclasses, enum-member defaults, inline root wrappers, schema-accurate nullability, and reproducible file headers. |
| Python 3.11+ targets | `--use-specialized-enum` | Use StrEnum or IntEnum only when the selected target Python version supports it. |
| Pydantic v2 BaseModel and dataclass output | `--snake-case-field`, `--allow-population-by-field-name`, `--use-frozen-field` | Generate Pythonic field names while preserving input aliases and readOnly immutability metadata. |
| msgspec Struct output | `--snake-case-field`, `--use-standard-primitive-types` | Generate Pythonic field names with aliases and stdlib primitive types for schema formats. |
| stdlib dataclass output | `--use-standard-primitive-types` | Use stdlib primitive types without renaming input keys because dataclasses do not carry aliases. |
| TypedDict output | `--use-standard-primitive-types`, `--use-frozen-field` | Use stdlib primitive types and ReadOnly metadata without renaming dictionary keys. |
| Practical model structure and names | `--reuse-model`, `--collapse-reuse-models`, `--use-title-as-name`, `--naming-strategy primary-first` | Deduplicate identical models without empty inheritance wrappers, prefer schema titles for class names, and keep primary definitions ahead of inline duplicate names. |
| Practical typing and defaults | `--use-default-kwarg`, `--use-object-type`, `--use-tuple-for-fixed-items`, `--use-unique-items-as-set`, `--use-single-line-docstring` | Render defaults explicitly, prefer object for unconstrained values, preserve fixed and unique arrays, and keep short docstrings concise. |
| Schema documentation | `--use-schema-description`, `--use-field-description`, `--use-field-description-example` | Preserve schema and field descriptions, including examples, in generated model documentation. |

### `practical-py313-20260619`

Standard Python 3.13 output plus practical naming, deduplication, and schema documentation.

This immutable preset extends `standard-py313-20260619` with options that make generated models easier to read and use in real projects. It favors schema-authored names, model reuse, and embedded schema documentation over the most conservative output-shape stability.

- **Requires separate target Python version:** no
- **Target Python version:** 3.13

#### Included Options

These snippets show the equivalent expanded configuration without `--preset` for JSON Schema input, Pydantic v2 BaseModel output, and Python 3.13. Replace the input and output paths for your project.

=== "pyproject.toml"

    ```toml
    [tool.datamodel-codegen]
    allow-population-by-field-name = true
    collapse-reuse-models = true
    collapse-root-models = true
    disable-timestamp = true
    enum-field-as-literal = "one"
    input = "schema.json"
    input-file-type = "jsonschema"
    naming-strategy = "primary-first"
    output = "model.py"
    output-model-type = "pydantic_v2.BaseModel"
    reuse-model = true
    set-default-enum-member = true
    snake-case-field = true
    strict-nullable = true
    target-python-version = "3.13"
    use-annotated = true
    use-default-kwarg = true
    use-field-description = true
    use-field-description-example = true
    use-frozen-field = true
    use-object-type = true
    use-schema-description = true
    use-single-line-docstring = true
    use-specialized-enum = true
    use-standard-collections = true
    use-subclass-enum = true
    use-title-as-name = true
    use-tuple-for-fixed-items = true
    use-union-operator = true
    use-unique-items-as-set = true
    ```

=== "CLI"

    ```bash
    datamodel-codegen --allow-population-by-field-name --collapse-reuse-models --collapse-root-models --disable-timestamp --enum-field-as-literal one --input schema.json --input-file-type jsonschema --naming-strategy primary-first --output model.py --output-model-type pydantic_v2.BaseModel --reuse-model --set-default-enum-member --snake-case-field --strict-nullable --target-python-version 3.13 --use-annotated --use-default-kwarg --use-field-description --use-field-description-example --use-frozen-field --use-object-type --use-schema-description --use-single-line-docstring --use-specialized-enum --use-standard-collections --use-subclass-enum --use-title-as-name --use-tuple-for-fixed-items --use-union-operator --use-unique-items-as-set
    ```

| Scope | Options | Notes |
|-------|---------|-------|
| All output model types | `--use-standard-collections`, `--use-union-operator`, `--use-annotated`, `--enum-field-as-literal one`, `--use-subclass-enum`, `--collapse-root-models`, `--strict-nullable`, `--set-default-enum-member`, `--disable-timestamp` | Use built-in collection syntax, PEP 604 unions, Annotated constraints, single-value enum Literals, typed enum subclasses, enum-member defaults, inline root wrappers, schema-accurate nullability, and reproducible file headers. |
| Python 3.11+ targets | `--use-specialized-enum` | Use StrEnum or IntEnum only when the selected target Python version supports it. |
| Pydantic v2 BaseModel and dataclass output | `--snake-case-field`, `--allow-population-by-field-name`, `--use-frozen-field` | Generate Pythonic field names while preserving input aliases and readOnly immutability metadata. |
| msgspec Struct output | `--snake-case-field`, `--use-standard-primitive-types` | Generate Pythonic field names with aliases and stdlib primitive types for schema formats. |
| stdlib dataclass output | `--use-standard-primitive-types` | Use stdlib primitive types without renaming input keys because dataclasses do not carry aliases. |
| TypedDict output | `--use-standard-primitive-types`, `--use-frozen-field` | Use stdlib primitive types and ReadOnly metadata without renaming dictionary keys. |
| Practical model structure and names | `--reuse-model`, `--collapse-reuse-models`, `--use-title-as-name`, `--naming-strategy primary-first` | Deduplicate identical models without empty inheritance wrappers, prefer schema titles for class names, and keep primary definitions ahead of inline duplicate names. |
| Practical typing and defaults | `--use-default-kwarg`, `--use-object-type`, `--use-tuple-for-fixed-items`, `--use-unique-items-as-set`, `--use-single-line-docstring` | Render defaults explicitly, prefer object for unconstrained values, preserve fixed and unique arrays, and keep short docstrings concise. |
| Schema documentation | `--use-schema-description`, `--use-field-description`, `--use-field-description-example` | Preserve schema and field descriptions, including examples, in generated model documentation. |

### `practical-py314-20260619`

Standard Python 3.14 output plus practical naming, deduplication, and schema documentation.

This immutable preset extends `standard-py314-20260619` with options that make generated models easier to read and use in real projects. It favors schema-authored names, model reuse, and embedded schema documentation over the most conservative output-shape stability.

- **Requires separate target Python version:** no
- **Target Python version:** 3.14

#### Included Options

These snippets show the equivalent expanded configuration without `--preset` for JSON Schema input, Pydantic v2 BaseModel output, and Python 3.14. Replace the input and output paths for your project.

=== "pyproject.toml"

    ```toml
    [tool.datamodel-codegen]
    allow-population-by-field-name = true
    collapse-reuse-models = true
    collapse-root-models = true
    disable-timestamp = true
    enum-field-as-literal = "one"
    input = "schema.json"
    input-file-type = "jsonschema"
    naming-strategy = "primary-first"
    output = "model.py"
    output-model-type = "pydantic_v2.BaseModel"
    reuse-model = true
    set-default-enum-member = true
    snake-case-field = true
    strict-nullable = true
    target-python-version = "3.14"
    use-annotated = true
    use-default-kwarg = true
    use-field-description = true
    use-field-description-example = true
    use-frozen-field = true
    use-object-type = true
    use-schema-description = true
    use-single-line-docstring = true
    use-specialized-enum = true
    use-standard-collections = true
    use-subclass-enum = true
    use-title-as-name = true
    use-tuple-for-fixed-items = true
    use-union-operator = true
    use-unique-items-as-set = true
    ```

=== "CLI"

    ```bash
    datamodel-codegen --allow-population-by-field-name --collapse-reuse-models --collapse-root-models --disable-timestamp --enum-field-as-literal one --input schema.json --input-file-type jsonschema --naming-strategy primary-first --output model.py --output-model-type pydantic_v2.BaseModel --reuse-model --set-default-enum-member --snake-case-field --strict-nullable --target-python-version 3.14 --use-annotated --use-default-kwarg --use-field-description --use-field-description-example --use-frozen-field --use-object-type --use-schema-description --use-single-line-docstring --use-specialized-enum --use-standard-collections --use-subclass-enum --use-title-as-name --use-tuple-for-fixed-items --use-union-operator --use-unique-items-as-set
    ```

| Scope | Options | Notes |
|-------|---------|-------|
| All output model types | `--use-standard-collections`, `--use-union-operator`, `--use-annotated`, `--enum-field-as-literal one`, `--use-subclass-enum`, `--collapse-root-models`, `--strict-nullable`, `--set-default-enum-member`, `--disable-timestamp` | Use built-in collection syntax, PEP 604 unions, Annotated constraints, single-value enum Literals, typed enum subclasses, enum-member defaults, inline root wrappers, schema-accurate nullability, and reproducible file headers. |
| Python 3.11+ targets | `--use-specialized-enum` | Use StrEnum or IntEnum only when the selected target Python version supports it. |
| Pydantic v2 BaseModel and dataclass output | `--snake-case-field`, `--allow-population-by-field-name`, `--use-frozen-field` | Generate Pythonic field names while preserving input aliases and readOnly immutability metadata. |
| msgspec Struct output | `--snake-case-field`, `--use-standard-primitive-types` | Generate Pythonic field names with aliases and stdlib primitive types for schema formats. |
| stdlib dataclass output | `--use-standard-primitive-types` | Use stdlib primitive types without renaming input keys because dataclasses do not carry aliases. |
| TypedDict output | `--use-standard-primitive-types`, `--use-frozen-field` | Use stdlib primitive types and ReadOnly metadata without renaming dictionary keys. |
| Practical model structure and names | `--reuse-model`, `--collapse-reuse-models`, `--use-title-as-name`, `--naming-strategy primary-first` | Deduplicate identical models without empty inheritance wrappers, prefer schema titles for class names, and keep primary definitions ahead of inline duplicate names. |
| Practical typing and defaults | `--use-default-kwarg`, `--use-object-type`, `--use-tuple-for-fixed-items`, `--use-unique-items-as-set`, `--use-single-line-docstring` | Render defaults explicitly, prefer object for unconstrained values, preserve fixed and unique arrays, and keep short docstrings concise. |
| Schema documentation | `--use-schema-description`, `--use-field-description`, `--use-field-description-example` | Preserve schema and field descriptions, including examples, in generated model documentation. |
