diff --git a/d2oracle/edit.go b/d2oracle/edit.go index 3891c35b8..efd7134c6 100644 --- a/d2oracle/edit.go +++ b/d2oracle/edit.go @@ -1886,7 +1886,7 @@ func MoveIDDeltas(g *d2graph.Graph, key, newKey string) (deltas map[string]strin } if _, ok := g.Root.HasChild(d2graph.Key(hoistedMK.Key)); ok || conflictsWithNewID { - newKey, _, err := generateUniqueKey(g, hoistedAbsID, nil, newIDs) + newKey, _, err := generateUniqueKey(g, hoistedAbsID, obj, newIDs) if err != nil { return nil, err } diff --git a/d2oracle/edit_test.go b/d2oracle/edit_test.go index 9322bf67c..615c1009c 100644 --- a/d2oracle/edit_test.go +++ b/d2oracle/edit_test.go @@ -3372,6 +3372,24 @@ b: { exp: `b: { a } +`, + }, + { + name: "container_conflicts_generated", + text: `Square 2: "" { + Square: "" +} +Square: "" +Square 3 +`, + key: `Square 2`, + newKey: `Square 3.Square 2`, + + exp: `Square 4: "" +Square: "" +Square 3: { + Square 2: "" +} `, }, } @@ -4939,6 +4957,7 @@ Text Text 2 `, }, + { name: "drop_value", text: `a.b.c: "c label" @@ -5278,6 +5297,22 @@ x.a -> x.b "x.(a -> b)[0]": "(a 2 -> b)[0]", "x.a": "a 2", "x.b": "b" +}`, + }, + { + name: "container_conflicts_generated", + text: `Square 2: "" { + Square: "" +} +Square: "" +Square 3 +`, + key: `Square 2`, + newKey: `Square 3.Square 2`, + + exp: `{ + "Square 2": "Square 3.Square 2", + "Square 2.Square": "Square 2" }`, }, } diff --git a/d2oracle/get.go b/d2oracle/get.go index 2d8e220ab..ff9de18eb 100644 --- a/d2oracle/get.go +++ b/d2oracle/get.go @@ -14,7 +14,7 @@ func GetParentID(g *d2graph.Graph, absID string) (string, error) { } obj, ok := g.Root.HasChild(d2graph.Key(mk.Key)) if !ok { - return "", fmt.Errorf("%v parent not found", absID) + return "", fmt.Errorf("%v not found", absID) } return obj.Parent.AbsID(), nil