tools/patches/d2/self_referencing_connection...

26 lines
608 B
Diff

diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go
index 5e3f5e5..c2d5511 100644
--- a/d2graph/d2graph.go
+++ b/d2graph/d2graph.go
@@ -721,20 +721,16 @@ func (obj *Object) Connect(srcID, dstID []string, srcArrow, dstArrow bool, label
return nil, errors.New("cannot connect to reserved keyword")
}
}
}
src := srcObj.EnsureChild(srcID)
dst := dstObj.EnsureChild(dstID)
- if src == dst {
- return nil, errors.New("self-referencing connection")
- }
-
edge := &Edge{
Attributes: Attributes{
Label: Scalar{
Value: label,
},
},
Src: src,
SrcArrow: srcArrow,