Skip to content

Commit 2d12ad9

Browse files
fix(compat): compat with pydantic<2.8.0 when using additional fields
1 parent 4caed43 commit 2d12ad9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/finch/types/hris/benefits_support.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,14 @@ class BenefitsSupport(BaseModel):
3535

3636
simple_ira: Optional[BenefitFeaturesAndOperations] = None
3737

38-
__pydantic_extra__: Dict[str, Optional[BenefitFeaturesAndOperations]] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
3938
if TYPE_CHECKING:
39+
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
40+
# value to this field, so for compatibility we avoid doing it at runtime.
41+
__pydantic_extra__: Dict[str, Optional[BenefitFeaturesAndOperations]] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
42+
4043
# Stub to indicate that arbitrary properties are accepted.
4144
# To access properties that are not valid identifiers you can use `getattr`, e.g.
4245
# `getattr(obj, '$type')`
4346
def __getattr__(self, attr: str) -> Optional[BenefitFeaturesAndOperations]: ...
47+
else:
48+
__pydantic_extra__: Dict[str, Optional[BenefitFeaturesAndOperations]]

0 commit comments

Comments
 (0)