delete id deltas reserved
This commit is contained in:
parent
95eccae9c1
commit
b1a1b2300c
2 changed files with 17 additions and 0 deletions
|
|
@ -1864,6 +1864,12 @@ func DeleteIDDeltas(g *d2graph.Graph, key string) (deltas map[string]string, err
|
||||||
conflictNewIDs := make(map[*d2graph.Object]string)
|
conflictNewIDs := make(map[*d2graph.Object]string)
|
||||||
conflictOldIDs := make(map[*d2graph.Object]string)
|
conflictOldIDs := make(map[*d2graph.Object]string)
|
||||||
if mk.Key != nil {
|
if mk.Key != nil {
|
||||||
|
ida := d2graph.Key(mk.Key)
|
||||||
|
// Deleting a reserved field cannot possibly have any deltas
|
||||||
|
if _, ok := d2graph.ReservedKeywords[ida[len(ida)-1]]; ok {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
obj, ok = g.Root.HasChild(d2graph.Key(mk.Key))
|
obj, ok = g.Root.HasChild(d2graph.Key(mk.Key))
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
||||||
|
|
@ -4895,7 +4895,18 @@ x.y.z.w.e.p.l -> x.y.z.1.2.3.4
|
||||||
"x.x": "x"
|
"x.x": "x"
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "nested-height",
|
||||||
|
|
||||||
|
text: `x: {
|
||||||
|
a -> b
|
||||||
|
height: 200
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
key: `x.height`,
|
||||||
|
|
||||||
|
exp: `null`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "only-reserved",
|
name: "only-reserved",
|
||||||
text: `guitar: {
|
text: `guitar: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue