feat(api): add description parameter to editable dataset change entity event (#10237)

This commit is contained in:
Ellie O'Neil 2024-04-09 02:46:44 -07:00 committed by GitHub
parent 278a39d3df
commit 1625de8e8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 72 additions and 0 deletions

View File

@ -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.

View File

@ -5,6 +5,7 @@ import static com.linkedin.metadata.timeline.eventgenerator.EditableDatasetPrope
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;
@ -42,6 +43,7 @@ public class DatasetPropertiesChangeEventGenerator
.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) {
@ -53,6 +55,7 @@ public class DatasetPropertiesChangeEventGenerator
.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
@ -67,6 +70,7 @@ public class DatasetPropertiesChangeEventGenerator
.semVerChange(SemanticChangeType.MINOR)
.description(
String.format(DESCRIPTION_CHANGED, entityUrn, baseDescription, targetDescription))
.parameters(ImmutableMap.of("description", targetDescription))
.auditStamp(auditStamp)
.build());
}

View File

@ -4,6 +4,7 @@ import static com.linkedin.metadata.Constants.*;
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;
@ -57,6 +58,7 @@ public class EditableDatasetPropertiesChangeEventGenerator
.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) {
@ -67,6 +69,7 @@ public class EditableDatasetPropertiesChangeEventGenerator
.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
@ -80,6 +83,7 @@ public class EditableDatasetPropertiesChangeEventGenerator
.semVerChange(SemanticChangeType.MINOR)
.description(
String.format(DESCRIPTION_CHANGED, entityUrn, baseDescription, targetDescription))
.parameters(ImmutableMap.of("description", targetDescription))
.auditStamp(auditStamp)
.build();
}