Skip to content

Commit

Permalink
feat(api): Add description parameter to editable dataset change entit…
Browse files Browse the repository at this point in the history
…y event (#2388)
  • Loading branch information
eboneil committed Apr 8, 2024
1 parent deaeabf commit a47d8d3
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
64 changes: 64 additions & 0 deletions docs/managed-datahub/datahub-api/entity-events-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,70 @@ This event is emitted when an existing owner has been removed from an entity on
}
```

### Add Description Event

This event is emitted when a description has been added to an entity on DataHub.

#### Header

<table><thead><tr><th>Category</th><th>Operation</th><th>Entity Types</th><th data-hidden></th></tr></thead><tbody><tr><td>DOCUMENTATION</td><td>ADD</td><td><code>dataset</code>, <code>dashboard</code>, <code>chart</code>, <code>dataJob</code>, <code>dataFlow</code> , <code>container</code>, <code>glossaryTerm</code>, <code>domain</code>, <code>tag</code></td><td></td></tr></tbody></table>

#### Parameters

| Name | Type | Description | Optional |
|-------------| ------ |--------------------------------------------------------------------------------------------------------------| -------- |
| description | String | The description that has been added. | False |

#### Sample Event

```
{
"entityUrn": "urn:li:dataset:abc",
"entityType": "dataset",
"category": "DOCUMENTATION",
"operation": "ADD",
"parameters": {
"description": "This is a new description"
},
"auditStamp": {
"actor": "urn:li:corpuser:jdoe",
"time": 1706646452982
}
}
```

### Remove Description Event

This event is emitted when an existing description has been removed from an entity on DataHub.

#### Header

<table><thead><tr><th>Category</th><th>Operation</th><th>Entity Types</th><th data-hidden></th></tr></thead><tbody><tr><td>DOCUMENTATION</td><td>REMOVE</td><td><code>dataset</code>, <code>dashboard</code>, <code>chart</code>, <code>dataJob</code>, <code>container</code> ,<code>dataFlow</code> , <code>glossaryTerm</code>, <code>domain</code>, <code>tag</code></td><td></td></tr></tbody></table>

#### Parameters

| Name | Type | Description | Optional |
|-------------| ------ |----------------------------------------| -------- |
| description | String | The description that has been removed. | False |

#### Sample Event

```
{
"entityUrn": "urn:li:dataset:abc",
"entityType": "dataset",
"category": "DOCUMENTATION",
"operation": "REMOVE",
"parameters": {
"description": "This is the removed description"
},
"auditStamp": {
"actor": "urn:li:corpuser:jdoe",
"time": 1706646452982
}
}
```

### Modify Deprecation Event

This event is emitted when the deprecation status of an entity has been modified on DataHub.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.datahub.util.RecordUtils;
import com.github.fge.jsonpatch.JsonPatch;
import com.google.common.collect.ImmutableMap;
import com.linkedin.common.AuditStamp;
import com.linkedin.common.urn.Urn;
import com.linkedin.dataset.DatasetProperties;
Expand Down Expand Up @@ -42,6 +43,7 @@ private static List<ChangeEvent> computeDiffs(
.operation(ChangeOperation.ADD)
.semVerChange(SemanticChangeType.MINOR)
.description(String.format(DESCRIPTION_ADDED, entityUrn, targetDescription))
.parameters(ImmutableMap.of("description", targetDescription))
.auditStamp(auditStamp)
.build());
} else if (baseDescription != null && targetDescription == null) {
Expand All @@ -53,6 +55,7 @@ private static List<ChangeEvent> computeDiffs(
.operation(ChangeOperation.REMOVE)
.semVerChange(SemanticChangeType.MINOR)
.description(String.format(DESCRIPTION_REMOVED, entityUrn, baseDescription))
.parameters(ImmutableMap.of("description", baseDescription))
.auditStamp(auditStamp)
.build());
} else if (baseDescription != null
Expand All @@ -67,6 +70,7 @@ private static List<ChangeEvent> computeDiffs(
.semVerChange(SemanticChangeType.MINOR)
.description(
String.format(DESCRIPTION_CHANGED, entityUrn, baseDescription, targetDescription))
.parameters(ImmutableMap.of("description", targetDescription))
.auditStamp(auditStamp)
.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.datahub.util.RecordUtils;
import com.github.fge.jsonpatch.JsonPatch;
import com.google.common.collect.ImmutableMap;
import com.linkedin.common.AuditStamp;
import com.linkedin.common.urn.Urn;
import com.linkedin.dataset.EditableDatasetProperties;
Expand Down Expand Up @@ -57,6 +58,7 @@ private static ChangeEvent getDescriptionChangeEvent(
.operation(ChangeOperation.ADD)
.semVerChange(SemanticChangeType.MINOR)
.description(String.format(DESCRIPTION_ADDED, entityUrn, targetDescription))
.parameters(ImmutableMap.of("description", targetDescription))
.auditStamp(auditStamp)
.build();
} else if (baseDescription != null && targetDescription == null) {
Expand All @@ -67,6 +69,7 @@ private static ChangeEvent getDescriptionChangeEvent(
.operation(ChangeOperation.REMOVE)
.semVerChange(SemanticChangeType.MINOR)
.description(String.format(DESCRIPTION_REMOVED, entityUrn, baseDescription))
.parameters(ImmutableMap.of("description", baseDescription))
.auditStamp(auditStamp)
.build();
} else if (baseDescription != null
Expand All @@ -80,6 +83,7 @@ private static ChangeEvent getDescriptionChangeEvent(
.semVerChange(SemanticChangeType.MINOR)
.description(
String.format(DESCRIPTION_CHANGED, entityUrn, baseDescription, targetDescription))
.parameters(ImmutableMap.of("description", targetDescription))
.auditStamp(auditStamp)
.build();
}
Expand Down

0 comments on commit a47d8d3

Please sign in to comment.