Skip to content

Commit c38daa0

Browse files
committed
Import from typing_extension in pydantic models for 3.7 support
1 parent 14bb975 commit c38daa0

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tests/test_loaders_dumpers/models/books_normalized_pydantic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22
from datetime import datetime, date
33
from enum import Enum
4-
from typing import List, Dict, Optional, Any, Union, Literal
4+
from typing import List, Dict, Optional, Any, Union
5+
from typing_extensions import Literal
56
from pydantic import BaseModel as BaseModel, Field
67
from linkml_runtime.linkml_model import Decimal
78

tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22
from datetime import datetime, date
33
from enum import Enum
4-
from typing import List, Dict, Optional, Any, Union, Literal
4+
from typing import List, Dict, Optional, Any, Union
5+
from typing_extensions import Literal
56
from pydantic import BaseModel as BaseModel, Field
67
from linkml_runtime.linkml_model import Decimal
78

@@ -17,7 +18,7 @@ class ConfiguredBaseModel(WeakRefShimBaseModel,
1718
underscore_attrs_are_private = True,
1819
extra = 'forbid',
1920
arbitrary_types_allowed = True,
20-
use_enum_values = False):
21+
use_enum_values = True):
2122
pass
2223

2324

@@ -169,8 +170,8 @@ class FamilialRelationship(Relationship):
169170

170171
started_at_time: Optional[date] = Field(None)
171172
ended_at_time: Optional[date] = Field(None)
172-
related_to: str = Field(None)
173-
type: FamilialRelationshipType = Field(None)
173+
related_to: str = Field(...)
174+
type: FamilialRelationshipType = Field(...)
174175

175176

176177

0 commit comments

Comments
 (0)