Resolve inheritance between identified records

This commit is contained in:
2026-10-23 20:48:46 +00:00
parent 268fd03579
commit 33a51606da
10 changed files with 447 additions and 31 deletions

View File

@@ -159,6 +159,25 @@ func preserveInheritanceIdentityFields(merged, child *document.Node, fields []st
}
}
func inheritanceParentPayload(parent *document.Node, identityFields []string) *document.Node {
cloned := document.Clone(parent)
if len(identityFields) == 0 || cloned == nil || cloned.Kind != document.Mapping {
return cloned
}
excluded := make(map[string]struct{}, len(identityFields))
for _, field := range identityFields {
excluded[field] = struct{}{}
}
kept := cloned.Mapping[:0]
for _, entry := range cloned.Mapping {
if _, omit := excluded[entry.Key]; !omit {
kept = append(kept, entry)
}
}
cloned.Mapping = kept
return cloned
}
func applyIdentifiedInheritanceTemplates(
graph *identifiedInheritanceGraph,
limits projectionLimits,