File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1216,21 +1216,21 @@ and generated code stay in sync. Works with both single files and directory outp
12161216 ```python
12171217 # generated by datamodel-codegen:
12181218 # filename: person.json
1219-
1219+
12201220 from __future__ import annotations
1221-
1222- from typing import Any
1223-
1221+
1222+ from typing import Any, List, Optional
1223+
12241224 from pydantic import BaseModel, Field, conint
1225-
1226-
1225+
1226+
12271227 class Person(BaseModel):
1228- firstName: str | None = Field(None, description="The person's first name.")
1229- lastName: str | None = Field(None, description="The person's last name.")
1230- age: conint(ge=0) | None = Field(
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(
12311231 None, description='Age in years which must be equal to or greater than zero.'
12321232 )
1233- friends: list[ Any] | None = None
1233+ friends: Optional[List[ Any]] = None
12341234 comment: None = None
12351235 ```
12361236
You can’t perform that action at this time.
0 commit comments