33
44from __future__ import annotations
55
6- from typing import Optional , Union
7-
86from pydantic import ConfigDict , Field
97
108from oold .model import LinkedBaseModel
@@ -14,10 +12,10 @@ class Subschema1(LinkedBaseModel):
1412 model_config = ConfigDict (
1513 json_schema_extra = {"custom_key" : "custom_value" , "title" : "Subschema1" },
1614 )
17- subprop0 : Optional [ str ] = Field (
15+ subprop0 : str | None = Field (
1816 None , json_schema_extra = {"custom_key" : "custom_value_0" }
1917 )
20- subprop1 : Optional [ str ] = Field (
18+ subprop1 : str | None = Field (
2119 None , json_schema_extra = {"custom_key" : "custom_value_1" }
2220 )
2321
@@ -26,10 +24,10 @@ class Subschema2(LinkedBaseModel):
2624 model_config = ConfigDict (
2725 json_schema_extra = {"custom_key" : "custom_value" , "title" : "Subschema2" },
2826 )
29- subprop0 : Optional [ str ] = Field (
27+ subprop0 : str | None = Field (
3028 None , json_schema_extra = {"custom_key" : "custom_value_0" }
3129 )
32- subprop2 : Optional [ str ] = Field (
30+ subprop2 : str | None = Field (
3331 None , json_schema_extra = {"custom_key" : "custom_value_2" }
3432 )
3533
@@ -38,8 +36,8 @@ class Example(LinkedBaseModel):
3836 model_config = ConfigDict (
3937 json_schema_extra = {"title" : "Example" },
4038 )
41- type : Optional [ str ] = ["example" ]
42- prop1 : Optional [ str ] = Field (None , json_schema_extra = {"custom_key" : "custom_value" })
43- prop2 : Optional [ Union [ Subschema1 , Subschema2 ]] = Field (
39+ type : str | None = ["example" ]
40+ prop1 : str | None = Field (None , json_schema_extra = {"custom_key" : "custom_value" })
41+ prop2 : Subschema1 | Subschema2 | None = Field (
4442 None , json_schema_extra = {"custom_key" : "custom_value" }
4543 )
0 commit comments