2019-12-19 13:17:53 -08:00
# What is a metadata delta?
2019-12-18 18:57:18 -08:00
2025-04-16 16:55:51 -07:00
Rest.li supports [partial update ](https://linkedin.github.io/rest.li/user_guide/restli_server#partial_update ) natively without needing explicitly defined models.
However, the granularity of update is always limited to each field in a PDL model.
2019-12-18 18:57:18 -08:00
There are cases where the update need to happen at an even finer grain, e.g. adding or removing items from an array.
2025-04-16 16:55:51 -07:00
To this end, we’ re proposing the following entity-specific metadata delta model that allows atomic partial updates at any desired granularity.
2019-12-18 18:57:18 -08:00
Note that:
2025-04-16 16:55:51 -07:00
1. Just like metadata [aspects ](aspect.md ), we’ re not imposing any limit on the partial update model, as long as it’ s a valid PDL record.
This is because the rest.li endpoint will have the logic that performs the corresponding partial update based on the information in the model.
That said, it’ s common to have fields that denote the list of items to be added or removed (e.g. `membersToAdd` & `membersToRemove` from below)
2. Similar to metadata [snapshots ](snapshot.md ), entity that supports metadata delta will add an entity-specific metadata delta
(e.g. `GroupDelta` from below) that unions all supported partial update models.
2019-12-18 18:57:18 -08:00
3. The entity-specific metadata delta is then added to the global `Delta` typeref, which is added as part of [Metadata Change Event ](mxe.md#metadata-change-event-mce ) and used during [Metadata Ingestion ](../architecture/metadata-ingestion.md ).
```
2020-05-21 10:49:23 -07:00
namespace com.linkedin.group
import com.linkedin.common.CorpuserUrn
/**
* A metadata delta for a specific group entity
*/
record MembershipPartialUpdate {
2025-04-16 16:55:51 -07:00
2020-05-21 10:49:23 -07:00
/** List of members to be added to the group */
membersToAdd: array[CorpuserUrn]
2019-12-18 18:57:18 -08:00
2020-05-21 10:49:23 -07:00
/** List of members to be removed from the group */
membersToRemove: array[CorpuserUrn]
2019-12-18 18:57:18 -08:00
}
```
2020-05-21 10:49:23 -07:00
```
namespace com.linkedin.metadata.delta
import com.linkedin.common.CorpGroupUrn
import com.linkedin.group.MembershipPartialUpdate
/**
* A metadata delta for a specific group entity
*/
record GroupDelta {
/** URN for the entity the metadata delta is associated with */
urn: CorpGroupUrn
/** The specific type of metadata delta to apply */
delta: union[MembershipPartialUpdate]
2019-12-18 18:57:18 -08:00
}
2020-05-21 10:49:23 -07:00
```
```
namespace com.linkedin.metadata.delta
/**
* A union of all supported metadata delta types.
*/
typeref Delta = union[GroupDelta]
2025-04-16 16:55:51 -07:00
```