mirror of
https://github.com/datahub-project/datahub.git
synced 2025-06-27 05:03:31 +00:00
fix(entity registry): Fix patching aspects onto existing Config based entity (#7624)
This commit is contained in:
parent
482431bcf4
commit
2978cdb409
@ -4,6 +4,7 @@ import com.linkedin.data.schema.compatibility.CompatibilityChecker;
|
||||
import com.linkedin.data.schema.compatibility.CompatibilityOptions;
|
||||
import com.linkedin.data.schema.compatibility.CompatibilityResult;
|
||||
import com.linkedin.metadata.models.AspectSpec;
|
||||
import com.linkedin.metadata.models.ConfigEntitySpec;
|
||||
import com.linkedin.metadata.models.DefaultEntitySpec;
|
||||
import com.linkedin.metadata.models.EntitySpec;
|
||||
import com.linkedin.metadata.models.EventSpec;
|
||||
@ -108,6 +109,13 @@ public class MergedEntityRegistry implements EntityRegistry {
|
||||
private EntitySpec mergeEntitySpecs(EntitySpec existingEntitySpec, EntitySpec newEntitySpec) {
|
||||
Map<String, AspectSpec> aspectSpecMap = new HashMap<>(existingEntitySpec.getAspectSpecMap());
|
||||
aspectSpecMap.putAll(newEntitySpec.getAspectSpecMap());
|
||||
// If the base is a config spec, always create another config spec.
|
||||
if (existingEntitySpec instanceof ConfigEntitySpec) {
|
||||
return new ConfigEntitySpec(
|
||||
existingEntitySpec.getEntityAnnotation().getName(),
|
||||
existingEntitySpec.getEntityAnnotation().getKeyAspect(),
|
||||
aspectSpecMap.values());
|
||||
}
|
||||
return new DefaultEntitySpec(aspectSpecMap.values(), existingEntitySpec.getEntityAnnotation(),
|
||||
existingEntitySpec.getSnapshotSchema(), existingEntitySpec.getAspectTyperefSchema());
|
||||
}
|
||||
|
@ -3,3 +3,6 @@ entities:
|
||||
- name: dataset
|
||||
aspects:
|
||||
- customDataQualityRules
|
||||
- name: container
|
||||
aspects:
|
||||
- customDataQualityRules
|
Loading…
x
Reference in New Issue
Block a user