Skip to content

GOV-778 fix(typedef) | add show_as_featured to AttributeDef.Options to prevent silent data loss on update#906

Merged
Aryamanz29 merged 3 commits into
mainfrom
GOV-778
Apr 21, 2026
Merged

GOV-778 fix(typedef) | add show_as_featured to AttributeDef.Options to prevent silent data loss on update#906
Aryamanz29 merged 3 commits into
mainfrom
GOV-778

Conversation

@ankitpatnaik-atlan
Copy link
Copy Markdown
Contributor

@ankitpatnaik-atlan ankitpatnaik-atlan commented Apr 21, 2026

✨ Description

Problem

When updating a Custom Metadata typedef via the SDK (e.g. setting cm.options.is_locked = True
then calling typedef.update(cm)), the showAsFeatured setting on attribute definitions was
silently cleared in the backend.

Root Cause

AttributeDef.Options did not model the showAsFeatured field. Because AtlanObject uses
Config.extra = Extra.ignore, Pydantic silently discards unknown fields on parse. This meant:

  1. API response returns attributeDefs[*].options.showAsFeatured: true
  2. Pydantic parses into AttributeDef.Options → field unknown → dropped
  3. typedef.update() serializes the full CM (including attributeDefs) → showAsFeatured absent in payload
  4. Backend replaces attribute options (not merges) → field gone → UI toggle turns off

Fix

Add show_as_featured: Optional[bool] to AttributeDef.Options. The alias_generator = to_camel_case
on AtlanObject automatically maps this to showAsFeatured in API JSON, so the field now
round-trips correctly through fetch → modify → update.

Impact

Any SDK operation that fetched and re-submitted a CM typedef with showAsFeatured set on any
attribute was silently clearing that setting. No other attribute option fields are affected.

Jira link: [IGOV-778]


🧩 Type of change

Select all that apply:

  • 🚀 New feature (non-breaking change that adds functionality)
  • 🐛 Bug fix (non-breaking change that fixes an issue) — please include tests! Refer testing-toolkit 🧪
  • 🔄 Refactor (code change that neither fixes a bug nor adds a feature)
  • 🧹 Maintenance (chores, cleanup, minor improvements)
  • 💥 Breaking change (fix or feature that may break existing functionality)
  • 📦 Dependency upgrade/downgrade
  • 📚 Documentation updates

✅ How has this been tested? (e.g. screenshots, logs, workflow links)

Describe how the change was tested. Include:

  • Added integration tests
Screenshot 2026-04-21 at 12 20 18 Screenshot 2026-04-21 at 12 22 21

📋 Checklist

  • My code follows the project’s style guidelines
  • I’ve performed a self-review of my code
  • I’ve added comments in tricky or complex areas
  • I’ve updated the documentation as needed
  • There are no new warnings from my changes
  • I’ve added tests to cover my changes
  • All new and existing tests pass locally

@ankitpatnaik-atlan ankitpatnaik-atlan changed the title GOV-778: Add the showAsFeatured attributeDef to models GOV-778 fix(typedef) | add show_as_featured to AttributeDef.Options to prevent silent data loss on update Apr 21, 2026
Comment thread pyatlan/model/typedef.py
Copy link
Copy Markdown
Member

@Aryamanz29 Aryamanz29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! One minor request:

Could you please add/update the integration tests (for both pyatlan and pyatlan_v9) to use this property and validate it properly gets assigned to the CM attribute? 🙏

https://github.com/atlanhq/atlan-python/blob/main/tests/integration/custom_metadata_test.py#L248-L253

@Aryamanz29 Aryamanz29 merged commit f34a20c into main Apr 21, 2026
29 of 73 checks passed
@Aryamanz29 Aryamanz29 deleted the GOV-778 branch April 21, 2026 07:02
@Aryamanz29 Aryamanz29 added the feature New feature or request label Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants