Skip to content

Commit b701d1e

Browse files
cmgroteclaude
andcommitted
fix: default is_rich_text and custom_metadata_version to UNSET with __post_init__ injection
Both fields had concrete defaults (False / "v2") that caused omit_defaults=True to silently drop them when the server sent those exact values, breaking round-trip fidelity. Changed both to msgspec.UNSET and added a conditional __post_init__ on AttributeDef.Options that injects the defaults only when absent, so explicit values from Atlas responses are never clobbered. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 09f35be commit b701d1e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

pyatlan_v9/model/typedef.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ class AttributeDef(msgspec.Struct, kw_only=True, rename="camel", omit_defaults=T
454454
class Options(msgspec.Struct, kw_only=True, rename="camel", omit_defaults=True):
455455
"""Extensible options for a custom metadata attribute."""
456456

457-
custom_metadata_version: str = "v2"
457+
custom_metadata_version: Union[str, msgspec.UnsetType] = msgspec.UNSET
458458
"""Indicates the version of the custom metadata structure."""
459459

460460
description: Union[str, None, msgspec.UnsetType] = msgspec.UNSET
@@ -550,9 +550,15 @@ class Options(msgspec.Struct, kw_only=True, rename="camel", omit_defaults=True):
550550
)
551551
"""Other asset type names to restrict the attribute (JSON-encoded)."""
552552

553-
is_rich_text: Union[bool, None] = False
553+
is_rich_text: Union[bool, None, msgspec.UnsetType] = msgspec.UNSET
554554
"""Whether this attribute supports rich text formatting."""
555555

556+
def __post_init__(self) -> None:
557+
if self.custom_metadata_version is msgspec.UNSET:
558+
self.custom_metadata_version = "v2"
559+
if self.is_rich_text is msgspec.UNSET:
560+
self.is_rich_text = False
561+
556562
def __setattr__(self, name: str, value: object) -> None:
557563
super().__setattr__(name, value)
558564
if name == "multi_value_select" and value is True:

0 commit comments

Comments
 (0)