@@ -5,9 +5,17 @@ Generate Pydantic models from GraphQL schema definitions.
55## 🚀 Quick Start
66
77``` bash
8- datamodel-codegen --input schema.graphql --input-file-type graphql --output model.py
8+ datamodel-codegen \
9+ --input schema.graphql \
10+ --input-file-type graphql \
11+ --output-model-type pydantic_v2.BaseModel \
12+ --output model.py
913```
1014
15+ !!! tip "Why ` --output-model-type ` ?"
16+ Starting from version 0.53.0, explicitly specifying ` --output-model-type ` is recommended.
17+ See [ Omitting --output-model-type is deprecated] ( index.md#omitting---output-model-type-is-deprecated ) for details.
18+
1119!!! note "📦 Installation"
1220 GraphQL support requires the ` graphql ` extra:
1321 ```bash
@@ -148,7 +156,12 @@ print(books)
148156## 🎨 Custom Scalar Types
149157
150158``` bash
151- datamodel-codegen --input schema.graphql --input-file-type graphql --output model.py --extra-template-data data.json
159+ datamodel-codegen \
160+ --input schema.graphql \
161+ --input-file-type graphql \
162+ --output-model-type pydantic_v2.BaseModel \
163+ --extra-template-data data.json \
164+ --output model.py
152165```
153166
154167** schema.graphql**
@@ -215,7 +228,12 @@ as GraphQL servers typically don't expect this field in input data.
215228Use the ` --graphql-no-typename ` option to exclude this field:
216229
217230``` bash
218- datamodel-codegen --input schema.graphql --input-file-type graphql --output model.py --graphql-no-typename
231+ datamodel-codegen \
232+ --input schema.graphql \
233+ --input-file-type graphql \
234+ --output-model-type pydantic_v2.BaseModel \
235+ --graphql-no-typename \
236+ --output model.py
219237```
220238
221239** Before (default):**
0 commit comments