Skip to content

feat(glossary_term_relationship): support DataHub Cloud relationship types - #218

Open
gnawhnehpets wants to merge 2 commits into
mainfrom
feat/glossary-term-relationship-cloud-types
Open

gnawhnehpets wants to merge 2 commits into
mainfrom
feat/glossary-term-relationship-cloud-types

Conversation

@gnawhnehpets

Copy link
Copy Markdown
Collaborator

Summary

datahub_glossary_term_relationship now accepts the relationship types DataHub Cloud adds to TermRelationshipType: isRelatedTo, synonymOf, antonymOf, translatesTo and hasValue, alongside isA and hasA.

Until now a glossary whose terms are associated without inheriting from or containing each other couldn't be managed in Terraform without changing what its relationships mean. Business glossary YAML writes related_terms and values to the same aspect lists as isRelatedTo and hasValue, so existing edges can be adopted with import.

Changes

  • Client: accepts the new types. Read decodes all seven glossaryRelatedTerms lists, whose field names differ from the type names (isRelatedTo → relatedTerms, hasValue → values). Without this, Read would drop such edges from state and Terraform would recreate them on every plan.
  • Older instances: on open-source DataHub, or a Cloud release that predates these types, a Cloud-only type fails with an UnsupportedRelationshipTypeError that names the type and keeps the server's message. isA/hasA are unchanged everywhere.
  • Docs: the resource docs, registry example and CHANGELOG are updated.

Testing

  • Client unit tests round-trip each Cloud type and confirm the read-before-remove guard covers the new lists. They also check that only Cloud-only enum rejections are translated.
  • The mock server models all seven types.
  • TestAcc_GlossaryTermRelationship_CloudTypes (RequireCloud) runs create, a clean re-plan and import.
  • TestAcc_GlossaryTermRelationship_CloudTypeOnOSS (RequireOSS) covers the open-source error path.
  • make generate, make lint, make test and make test-examples pass locally.

…types

relationship_type now accepts isRelatedTo, synonymOf, antonymOf,
translatesTo and hasValue in addition to isA and hasA. These values are
in DataHub Cloud's TermRelationshipType enum, and addRelatedTerms /
removeRelatedTerms already handle them there.

Each type is stored in its own glossaryRelatedTerms list (isRelatedTo in
relatedTerms, hasValue in values), so Read now decodes all seven lists;
without that, Read would drop every such edge from state. Business
glossary YAML writes related_terms and values to the same lists, so
existing edges can be adopted with import.

Against open-source DataHub, or an older Cloud release, a Cloud-only
type fails with an UnsupportedRelationshipTypeError naming the type and
quoting the server's message. isA and hasA are unchanged everywhere.

The mock server now models all seven types. New acceptance tests cover
the Cloud types (RequireCloud) and the OSS error path (RequireOSS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd1DZb1TvHziJ7HThE8pKg
@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.35%. Comparing base (d25cfe0) to head (29a04d5).

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #218      +/-   ##
==========================================
+ Coverage   81.29%   81.35%   +0.05%     
==========================================
  Files         154      154              
  Lines       21383    21441      +58     
==========================================
+ Hits        17384    17444      +60     
+ Misses       3993     3991       -2     
  Partials        6        6              
Files with missing lines Coverage Δ
...al/provider/glossary_term_relationship_resource.go 87.20% <100.00%> (+1.26%) ⬆️
...nal/provider/pkg/datahub/glossary_related_terms.go 94.53% <100.00%> (+2.39%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…tedTerms.list

Replace the switch with a lookup table. The switch's trailing return nil
was reachable only for an unknown relationship type, which validation
already rejects, so it was never covered. Behaviour is unchanged: an
unknown type still yields nil.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd1DZb1TvHziJ7HThE8pKg

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants