Skip to content

Commit bef3fe5

Browse files
docs: remove pydantic v1 references (#3030)
* docs: remove pydantic v1 references * docs: clarify profile example naming * docs: update CLI reference documentation and prompt data 🤖 Generated by GitHub Actions * docs: address review feedback on v1 removal * docs: list pydantic dataclass in openapi outputs * docs: sync llms output for openapi docs * docs: fix cli doc summary generation --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 01c2f41 commit bef3fe5

30 files changed

Lines changed: 222 additions & 537 deletions

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/datamodel-code-generator)](https://pypi.python.org/pypi/datamodel-code-generator)
99
[![codecov](https://codecov.io/gh/koxudaxi/datamodel-code-generator/graph/badge.svg?token=plzSSFb9Li)](https://codecov.io/gh/koxudaxi/datamodel-code-generator)
1010
![license](https://img.shields.io/github/license/koxudaxi/datamodel-code-generator.svg)
11-
[![Pydantic v1](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v1.json)](https://pydantic.dev)
1211
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)
1312

1413
> 📣 💼 Maintainer update: Open to opportunities. 🔗 [koxudaxi.dev](https://koxudaxi.dev/?utm_source=github_readme&utm_medium=top&utm_campaign=open_to_work)
@@ -17,7 +16,7 @@
1716

1817
- 📄 Converts **OpenAPI 3**, **JSON Schema**, **GraphQL**, and raw data (JSON/YAML/CSV) into Python models
1918
- 🐍 Generates from **existing Python types** (Pydantic, dataclass, TypedDict) via `--input-model`
20-
- 🎯 Generates **Pydantic v1/v2**, **dataclasses**, **TypedDict**, or **msgspec** output
19+
- 🎯 Generates **Pydantic v2**, **Pydantic v2 dataclass**, **dataclasses**, **TypedDict**, or **msgspec** output
2120
- 🔗 Handles complex schemas: `$ref`, `allOf`, `oneOf`, `anyOf`, enums, and nested types
2221
- ✅ Produces type-safe, validated code ready for your IDE and type checker
2322

@@ -161,7 +160,6 @@ class Pet(BaseModel):
161160

162161
## 📤 Supported Output
163162

164-
- [pydantic v1](https://docs.pydantic.dev/1.10/) BaseModel
165163
- [pydantic v2](https://docs.pydantic.dev/) BaseModel
166164
- [pydantic v2](https://docs.pydantic.dev/) dataclass
167165
- [dataclasses](https://docs.python.org/3/library/dataclasses.html)

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ inputs:
1515
description: 'Input file type (openapi, jsonschema, json, yaml, csv, graphql)'
1616
required: true
1717
output-model-type:
18-
description: 'Output model type (pydantic_v2.BaseModel, pydantic.BaseModel, dataclasses.dataclass, typing.TypedDict, msgspec.Struct)'
18+
description: 'Output model type (pydantic_v2.BaseModel, pydantic_v2.dataclass, dataclasses.dataclass, typing.TypedDict, msgspec.Struct)'
1919
required: true
2020
check:
2121
description: 'Validate that existing output is up to date (no generation)'

docs/ci-cd.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ By default, the action runs in **check mode** (`--check`), which validates that
3333
| `input` | Yes | - | Input schema file or directory |
3434
| `output` | Yes | - | Output file or directory |
3535
| `input-file-type` | Yes | - | Input file type (`openapi`, `jsonschema`, `json`, `yaml`, `csv`, `graphql`) |
36-
| `output-model-type` | Yes | - | Output model type (`pydantic_v2.BaseModel`, `pydantic.BaseModel`, `dataclasses.dataclass`, `typing.TypedDict`, `msgspec.Struct`) |
36+
| `output-model-type` | Yes | - | Output model type (`pydantic_v2.BaseModel`, `pydantic_v2.dataclass`, `dataclasses.dataclass`, `typing.TypedDict`, `msgspec.Struct`) |
3737
| `check` | No | `true` | Validate that existing output is up to date (no generation) |
3838
| `working-directory` | No | `.` | Working directory (where `pyproject.toml` is located) |
3939
| `profile` | No | - | Named profile from `pyproject.toml` |

docs/cli-reference/base-options.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,4 +747,3 @@ Format: `HeaderName:HeaderValue`.
747747
```
748748

749749
---
750-

docs/cli-reference/field-customization.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3717,4 +3717,3 @@ This is useful when schemas have descriptive titles that should be preserved.
37173717
```
37183718

37193719
---
3720-

docs/cli-reference/general-options.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2038,4 +2038,3 @@ the generator waits the specified time before regenerating.
20382038
```
20392039

20402040
---
2041-

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,3 @@ don't expect this field in input data.
8888
```
8989

9090
---
91-

docs/cli-reference/manual/profile.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ file. Each profile can override the default settings with its own set of options
2727
strict-types = ["str", "int", "float", "bool"]
2828
strict-nullable = true
2929

30-
[tool.datamodel-codegen.profiles.legacy]
31-
# Legacy profile for Pydantic v1
32-
output-model-type = "pydantic.BaseModel"
30+
[tool.datamodel-codegen.profiles.dataclass]
31+
# Dataclass profile
32+
output-model-type = "dataclasses.dataclass"
3333
```
3434

3535
Use profiles:
@@ -38,6 +38,6 @@ file. Each profile can override the default settings with its own set of options
3838
# Use the strict profile
3939
datamodel-codegen --input schema.json --profile strict
4040

41-
# Use the legacy profile
42-
datamodel-codegen --input schema.json --profile legacy
41+
# Use the dataclass profile
42+
datamodel-codegen --input schema.json --profile dataclass
4343
```

docs/cli-reference/model-customization.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
| [`--collapse-reuse-models`](#collapse-reuse-models) | Collapse duplicate models by replacing references instead of... |
1616
| [`--collapse-root-models`](#collapse-root-models) | Inline root model definitions instead of creating separate w... |
1717
| [`--collapse-root-models-name-strategy`](#collapse-root-models-name-strategy) | Select which name to keep when collapsing root models with o... |
18-
| [`--dataclass-arguments`](#dataclass-arguments) | Customize dataclass decorator arguments via JSON dictionary.... |
18+
| [`--dataclass-arguments`](#dataclass-arguments) | Customize dataclass decorator arguments via JSON dictionary. |
1919
| [`--duplicate-name-suffix`](#duplicate-name-suffix) | Customize suffix for duplicate model names. |
2020
| [`--enable-faux-immutability`](#enable-faux-immutability) | Enable faux immutability in Pydantic models (frozen=True). |
2121
| [`--force-optional`](#force-optional) | Force all fields to be Optional regardless of required statu... |
@@ -25,15 +25,15 @@
2525
| [`--model-extra-keys`](#model-extra-keys) | Add model-level schema extensions to ConfigDict json_schema_... |
2626
| [`--model-extra-keys-without-x-prefix`](#model-extra-keys-without-x-prefix) | Strip x- prefix from model-level schema extensions and add t... |
2727
| [`--naming-strategy`](#naming-strategy) | Use parent-prefixed naming strategy for duplicate model name... |
28-
| [`--output-model-type`](#output-model-type) | Select the output model type (Pydantic v2, dataclasses, Type... |
28+
| [`--output-model-type`](#output-model-type) | Select the output model type (Pydantic v2, Pydantic v2 datac... |
2929
| [`--parent-scoped-naming`](#parent-scoped-naming) | Namespace models by their parent scope to avoid naming confl... |
3030
| [`--reuse-model`](#reuse-model) | Reuse identical model definitions instead of generating dupl... |
3131
| [`--reuse-scope`](#reuse-scope) | Scope for model reuse detection (root or tree). |
3232
| [`--skip-root-model`](#skip-root-model) | Skip generation of root model when schema contains nested de... |
3333
| [`--strict-nullable`](#strict-nullable) | Treat default field as a non-nullable field. |
3434
| [`--strip-default-none`](#strip-default-none) | Remove fields with None as default value from generated mode... |
3535
| [`--target-pydantic-version`](#target-pydantic-version) | Target Pydantic version for generated code compatibility. |
36-
| [`--target-python-version`](#target-python-version) | Target Python version for generated code syntax and imports.... |
36+
| [`--target-python-version`](#target-python-version) | Target Python version for generated code syntax and imports. |
3737
| [`--union-mode`](#union-mode) | Union mode for combining anyOf/oneOf schemas (smart or left_... |
3838
| [`--use-default`](#use-default) | Use default values from schema in generated models. |
3939
| [`--use-default-factory-for-optional-nested-models`](#use-default-factory-for-optional-nested-models) | Generate default_factory for optional nested model fields. |
@@ -1624,7 +1624,7 @@ control over dataclass generation.
16241624

16251625
**Related:** [`--frozen-dataclasses`](model-customization.md#frozen-dataclasses), [`--keyword-only`](model-customization.md#keyword-only)
16261626

1627-
**See also:** [Output Model Types](../what_is_the_difference_between_v1_and_v2.md)
1627+
**See also:** [Output Model Types](../output-model-types.md)
16281628

16291629
!!! tip "Usage"
16301630

@@ -2631,7 +2631,7 @@ keyword-only arguments.
26312631

26322632
**Related:** [`--keyword-only`](model-customization.md#keyword-only), [`--output-model-type`](model-customization.md#output-model-type)
26332633

2634-
**See also:** [Output Model Types](../what_is_the_difference_between_v1_and_v2.md)
2634+
**See also:** [Output Model Types](../output-model-types.md)
26352635

26362636
!!! tip "Usage"
26372637

@@ -2878,7 +2878,7 @@ positional argument errors.
28782878

28792879
**Related:** [`--frozen-dataclasses`](model-customization.md#frozen-dataclasses), [`--output-model-type`](model-customization.md#output-model-type), [`--target-python-version`](model-customization.md#target-python-version)
28802880

2881-
**See also:** [Output Model Types](../what_is_the_difference_between_v1_and_v2.md)
2881+
**See also:** [Output Model Types](../output-model-types.md)
28822882

28832883
!!! tip "Usage"
28842884

@@ -3460,13 +3460,14 @@ parent model name when duplicates occur. For example, if both `Order` and
34603460

34613461
## `--output-model-type` {#output-model-type}
34623462

3463-
Select the output model type (Pydantic v2, dataclasses, TypedDict, msgspec).
3463+
Select the output model type (Pydantic v2, Pydantic v2 dataclass,
3464+
dataclasses, TypedDict, msgspec).
34643465

34653466
The `--output-model-type` flag specifies which Python data model framework to use
34663467
for the generated code. Supported values include `pydantic_v2.BaseModel`,
3467-
`dataclasses.dataclass`, `typing.TypedDict`, and `msgspec.Struct`.
3468+
`pydantic_v2.dataclass`, `dataclasses.dataclass`, `typing.TypedDict`, and `msgspec.Struct`.
34683469

3469-
**See also:** [Output Model Types](../what_is_the_difference_between_v1_and_v2.md)
3470+
**See also:** [Output Model Types](../output-model-types.md)
34703471

34713472
!!! tip "Usage"
34723473

@@ -5066,7 +5067,7 @@ The `--target-python-version` flag controls Python version-specific syntax:
50665067

50675068
This affects import statements and type annotation syntax in generated code.
50685069

5069-
**See also:** [CI/CD Integration](../ci-cd.md), [Python Version Compatibility](../python-version-compatibility.md), [Output Model Types](../what_is_the_difference_between_v1_and_v2.md)
5070+
**See also:** [CI/CD Integration](../ci-cd.md), [Output Model Types](../output-model-types.md), [Python Version Compatibility](../python-version-compatibility.md)
50705071

50715072
!!! tip "Usage"
50725073

@@ -6227,4 +6228,3 @@ type, providing better type safety and IDE support.
62276228
```
62286229

62296230
---
6230-

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1715,4 +1715,3 @@ The `--validation` flag configures the code generation behavior.
17151715
```
17161716

17171717
---
1718-

0 commit comments

Comments
 (0)