fix(tags): Support null tagProperties aspect when updating tag color (#13572)

Co-authored-by: John Joyce <john@Mac.lan>
This commit is contained in:
John Joyce 2025-05-21 12:32:08 -07:00 committed by GitHub
parent 822be781cd
commit 3a81adb94a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 5 deletions

View File

@ -67,7 +67,7 @@ public class SetTagColorResolver implements DataFetcher<CompletableFuture<Boolea
tagUrn.toString(), tagUrn.toString(),
TAG_PROPERTIES_ASPECT_NAME, TAG_PROPERTIES_ASPECT_NAME,
_entityService, _entityService,
null); new TagProperties().setName(tagUrn.getId()));
if (tagProperties == null) { if (tagProperties == null) {
throw new IllegalArgumentException( throw new IllegalArgumentException(

View File

@ -76,7 +76,7 @@ public class SetTagColorResolverTest {
} }
@Test @Test
public void testGetFailureNoExistingProperties() throws Exception { public void testGetDefaultPropertiesIfNoExistingProperties() throws Exception {
// Create resolver // Create resolver
EntityClient mockClient = Mockito.mock(EntityClient.class); EntityClient mockClient = Mockito.mock(EntityClient.class);
EntityService<?> mockService = getMockEntityService(); EntityService<?> mockService = getMockEntityService();
@ -101,9 +101,21 @@ public class SetTagColorResolverTest {
Mockito.when(mockEnv.getArgument(Mockito.eq("urn"))).thenReturn(TEST_ENTITY_URN); Mockito.when(mockEnv.getArgument(Mockito.eq("urn"))).thenReturn(TEST_ENTITY_URN);
Mockito.when(mockEnv.getArgument(Mockito.eq("colorHex"))).thenReturn(TEST_COLOR_HEX); Mockito.when(mockEnv.getArgument(Mockito.eq("colorHex"))).thenReturn(TEST_COLOR_HEX);
Mockito.when(mockEnv.getContext()).thenReturn(mockContext); Mockito.when(mockEnv.getContext()).thenReturn(mockContext);
assertThrows(CompletionException.class, () -> resolver.get(mockEnv).join());
Mockito.verify(mockClient, Mockito.times(0)).ingestProposal(any(), Mockito.any(), anyBoolean()); boolean result = resolver.get(mockEnv).get();
assertTrue(result);
final TagProperties newTagProperties =
new TagProperties().setName("test-tag").setColorHex(TEST_COLOR_HEX);
final MetadataChangeProposal proposal =
MutationUtils.buildMetadataChangeProposalWithUrn(
UrnUtils.getUrn(TEST_ENTITY_URN), TAG_PROPERTIES_ASPECT_NAME, newTagProperties);
verifyIngestProposal(mockClient, 1, proposal);
Mockito.verify(mockService, Mockito.times(1))
.exists(any(), Mockito.eq(Urn.createFromString(TEST_ENTITY_URN)), eq(true));
} }
@Test @Test

View File

@ -32,7 +32,7 @@ const EmptyTags = ({ isEmptySearch }: Props) => {
<div> <div>
{!isEmptySearch && ( {!isEmptySearch && (
<Typography.Paragraph> <Typography.Paragraph>
Tags can be used to organize and categorize data assets across the platform. Tags can be used to organize data assets in DataHub.
</Typography.Paragraph> </Typography.Paragraph>
)} )}
</div> </div>