Skip to content

Commit f34a20c

Browse files
authored
Merge pull request #906 from atlanhq/GOV-778
GOV-778 fix(typedef) | add show_as_featured to AttributeDef.Options to prevent silent data loss on update
2 parents a34d753 + 83de13f commit f34a20c

4 files changed

Lines changed: 55 additions & 0 deletions

File tree

pyatlan/model/typedef.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,10 @@ class Options(AtlanObject):
551551
default=False,
552552
description="Whether this attribute supports rich text formatting (True) or not (False). ",
553553
)
554+
show_as_featured: Optional[bool] = Field(
555+
default=None,
556+
description="Whether this attribute is shown as featured in the asset profile (True) or not (False).",
557+
)
554558

555559
def __setattr__(self, name, value):
556560
super().__setattr__(name, value)

pyatlan_v9/model/typedef.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,9 @@ class Options(msgspec.Struct, kw_only=True, rename="camel", omit_defaults=True):
553553
is_rich_text: Union[bool, None, msgspec.UnsetType] = msgspec.UNSET
554554
"""Whether this attribute supports rich text formatting."""
555555

556+
show_as_featured: Union[bool, None, msgspec.UnsetType] = msgspec.UNSET
557+
"""Whether this attribute is shown as featured in the asset profile."""
558+
556559
def __post_init__(self) -> None:
557560
if self.custom_metadata_version is msgspec.UNSET:
558561
self.custom_metadata_version = "v2"

tests/integration/custom_metadata_test.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,30 @@ def test_cm_raci(
340340
assert not one.options.multi_value_select
341341

342342

343+
@pytest.mark.order(after="test_cm_raci")
344+
def test_show_as_featured_survives_update(
345+
client: AtlanClient, cm_raci: CustomMetadataDef
346+
):
347+
existing = client.custom_metadata_cache.get_custom_metadata_def(name=CM_RACI)
348+
assert existing.attribute_defs
349+
attr = existing.attribute_defs[0]
350+
assert attr.options
351+
attr.options.show_as_featured = True
352+
assert existing.options
353+
existing.options.is_locked = True
354+
response = client.typedef.update(existing)
355+
assert response
356+
assert len(response.custom_metadata_defs) == 1
357+
updated = response.custom_metadata_defs[0]
358+
assert updated.attribute_defs
359+
updated_attr = updated.attribute_defs[0]
360+
assert updated_attr.options
361+
assert updated_attr.options.show_as_featured is True
362+
assert updated.options
363+
updated.options.is_locked = False
364+
client.typedef.update(updated)
365+
366+
343367
@pytest.fixture(scope="module")
344368
def cm_enum(
345369
client: AtlanClient,

tests_v9/integration/custom_metadata_test.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,30 @@ def test_cm_raci(
340340
assert not one.options.multi_value_select
341341

342342

343+
@pytest.mark.order(after="test_cm_raci")
344+
def test_show_as_featured_survives_update(
345+
client: AtlanClient, cm_raci: CustomMetadataDef
346+
):
347+
existing = client.custom_metadata_cache.get_custom_metadata_def(name=CM_RACI)
348+
assert existing.attribute_defs
349+
attr = existing.attribute_defs[0]
350+
assert attr.options
351+
attr.options.show_as_featured = True
352+
assert existing.options
353+
existing.options.is_locked = True
354+
response = client.typedef.updater(existing)
355+
assert response
356+
assert len(response.custom_metadata_defs) == 1
357+
updated = response.custom_metadata_defs[0]
358+
assert updated.attribute_defs
359+
updated_attr = updated.attribute_defs[0]
360+
assert updated_attr.options
361+
assert updated_attr.options.show_as_featured is True
362+
assert updated.options
363+
updated.options.is_locked = False
364+
client.typedef.updater(updated)
365+
366+
343367
@pytest.fixture(scope="module")
344368
def cm_enum(
345369
client: AtlanClient,

0 commit comments

Comments
 (0)