@@ -1168,12 +1168,14 @@ The `--check` flag compares the generated output with existing files and exits w
11681168a non-zero status if they differ. Useful for CI/CD validation to ensure schemas
11691169and generated code stay in sync. Works with both single files and directory outputs.
11701170
1171+ ** Related:** [ ` --no-use-standard-collections ` ] ( typing-customization.md#no-use-standard-collections ) , [ ` --no-use-union-operator ` ] ( typing-customization.md#no-use-union-operator )
1172+
11711173** See also:** [ CI/CD Integration] ( ../ci-cd.md )
11721174
11731175!!! tip "Usage"
11741176
11751177 ```bash
1176- datamodel-codegen --input schema.json --disable-timestamp --check # (1)!
1178+ datamodel-codegen --input schema.json --disable-timestamp --use-union-operator --use-standard-collections -- check # (1)!
11771179 ```
11781180
11791181 1. :material-arrow-left: `--check` - the option documented here
@@ -1219,18 +1221,18 @@ and generated code stay in sync. Works with both single files and directory outp
12191221
12201222 from __future__ import annotations
12211223
1222- from typing import Any, List, Optional
1224+ from typing import Any
12231225
12241226 from pydantic import BaseModel, Field, conint
12251227
12261228
12271229 class Person(BaseModel):
1228- firstName: Optional[ str] = Field(None, description="The person's first name.")
1229- lastName: Optional[ str] = Field(None, description="The person's last name.")
1230- age: Optional[ conint(ge=0)] = Field(
1230+ firstName: str | None = Field(None, description="The person's first name.")
1231+ lastName: str | None = Field(None, description="The person's last name.")
1232+ age: conint(ge=0) | None = Field(
12311233 None, description='Age in years which must be equal to or greater than zero.'
12321234 )
1233- friends: Optional[List[ Any]] = None
1235+ friends: list[ Any] | None = None
12341236 comment: None = None
12351237 ```
12361238
0 commit comments