add experr

This commit is contained in:
Alexander Wang 2023-02-07 20:47:12 -08:00
parent dd5fde3876
commit 273496bc9e
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
7 changed files with 387 additions and 372 deletions

View file

@ -476,12 +476,12 @@ func (sd *sequenceDiagram) routeMessages() error {
if startCenter := getCenter(message.Src); startCenter != nil { if startCenter := getCenter(message.Src); startCenter != nil {
startX = startCenter.X startX = startCenter.X
} else { } else {
return fmt.Errorf("could not find center of %s", message.Src.AbsID()) return fmt.Errorf("could not find center of %s. Is it declared as an actor?", message.Src.ID)
} }
if endCenter := getCenter(message.Dst); endCenter != nil { if endCenter := getCenter(message.Dst); endCenter != nil {
endX = endCenter.X endX = endCenter.X
} else { } else {
return fmt.Errorf("could not find center of %s", message.Dst.AbsID()) return fmt.Errorf("could not find center of %s. Is it declared as an actor?", message.Dst.ID)
} }
isToDescendant := strings.HasPrefix(message.Dst.AbsID(), message.Src.AbsID()+".") isToDescendant := strings.HasPrefix(message.Dst.AbsID(), message.Src.AbsID()+".")
isFromDescendant := strings.HasPrefix(message.Src.AbsID(), message.Dst.AbsID()+".") isFromDescendant := strings.HasPrefix(message.Src.AbsID(), message.Dst.AbsID()+".")
@ -526,7 +526,7 @@ func (sd *sequenceDiagram) routeMessages() error {
func getCenter(obj *d2graph.Object) *geo.Point { func getCenter(obj *d2graph.Object) *geo.Point {
if obj == nil { if obj == nil {
return nil return nil
} else if obj.TopLeft != nil { } else if obj.Box != nil && obj.Box.TopLeft != nil {
return obj.Center() return obj.Center()
} }
return getCenter(obj.Parent) return getCenter(obj.Parent)

View file

@ -77,6 +77,7 @@ type testCase struct {
mtexts []*d2target.MText mtexts []*d2target.MText
assertions func(t *testing.T, diagram *d2target.Diagram) assertions func(t *testing.T, diagram *d2target.Diagram)
skip bool skip bool
expErr string
} }
func runa(t *testing.T, tcs []testCase) { func runa(t *testing.T, tcs []testCase) {
@ -148,7 +149,14 @@ func run(t *testing.T, tc testCase) {
ThemeID: 0, ThemeID: 0,
Layout: layout, Layout: layout,
}) })
trequire.Nil(t, err)
if tc.expErr != "" {
assert.Error(t, err)
assert.ErrorString(t, err, tc.expErr)
return
} else {
assert.Success(t, err)
}
if tc.assertions != nil { if tc.assertions != nil {
t.Run("assertions", func(t *testing.T) { t.Run("assertions", func(t *testing.T) {

View file

@ -486,6 +486,7 @@ group: {
} }
} }
`, `,
expErr: "could not find center of b. Is it declared as an actor?",
}, },
} }

View file

@ -3,13 +3,177 @@
"fontFamily": "SourceSansPro", "fontFamily": "SourceSansPro",
"shapes": [ "shapes": [
{ {
"id": "handler", "id": "a",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 24, "x": 24,
"y": 74 "y": 74
}, },
"width": 227, "width": 150,
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "a",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 7,
"labelHeight": 21,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
},
{
"id": "group",
"type": "rectangle",
"pos": {
"x": 25,
"y": 206
},
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 0,
"borderRadius": 0,
"fill": "#DEE1EB",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": true,
"fields": null,
"methods": null,
"columns": null,
"label": "group",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 40,
"labelHeight": 21,
"labelPosition": "INSIDE_TOP_LEFT",
"zIndex": 3,
"level": 1
},
{
"id": "group.inner_group",
"type": "rectangle",
"pos": {
"x": 49,
"y": 230
},
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#E3E9FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "inner_group",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 82,
"labelHeight": 21,
"labelPosition": "INSIDE_TOP_LEFT",
"zIndex": 3,
"level": 2
},
{
"id": "group.inner_group.b",
"type": "rectangle",
"pos": {
"x": 9223372036854775807,
"y": 9223372036854775807
},
"width": -9223372036854775808,
"height": -9223372036854775808,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "b",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 8,
"labelHeight": 21,
"labelPosition": "INSIDE_TOP_LEFT",
"zIndex": 3,
"level": 3
},
{
"id": "b",
"type": "rectangle",
"pos": {
"x": 274,
"y": 74
},
"width": 150,
"height": 66, "height": 66,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -29,7 +193,7 @@
"fields": null, "fields": null,
"methods": null, "methods": null,
"columns": null, "columns": null,
"label": "handlers (handler function)", "label": "b",
"fontSize": 16, "fontSize": 16,
"fontFamily": "DEFAULT", "fontFamily": "DEFAULT",
"language": "", "language": "",
@ -37,142 +201,20 @@
"italic": false, "italic": false,
"bold": false, "bold": false,
"underline": false, "underline": false,
"labelWidth": 182, "labelWidth": 8,
"labelHeight": 21, "labelHeight": 21,
"labelPosition": "INSIDE_MIDDLE_CENTER", "labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0, "zIndex": 0,
"level": 1 "level": 1
},
{
"id": "db",
"type": "rectangle",
"pos": {
"x": 313,
"y": 74
},
"width": 150,
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "db",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 18,
"labelHeight": 21,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
},
{
"id": "HTTP request",
"type": "rectangle",
"pos": {
"x": 563,
"y": 74
},
"width": 150,
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "HTTP request",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 91,
"labelHeight": 21,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
},
{
"id": "HTTP request.handlers",
"type": "rectangle",
"pos": {
"x": 632,
"y": 254
},
"width": 12,
"height": 80,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#E3E9FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 58,
"labelHeight": 21,
"zIndex": 2,
"level": 2
} }
], ],
"connections": [ "connections": [
{ {
"id": "(HTTP request.handlers -> db)[0]", "id": "(a -> b)[0]",
"src": "HTTP request.handlers", "src": "a",
"srcArrow": "none", "srcArrow": "none",
"srcLabel": "", "srcLabel": "",
"dst": "db", "dst": "b",
"dstArrow": "triangle", "dstArrow": "triangle",
"dstLabel": "", "dstLabel": "",
"opacity": 1, "opacity": 1,
@ -193,11 +235,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 632, "x": 99,
"y": 270 "y": 270
}, },
{ {
"x": 388, "x": 349,
"y": 270 "y": 270
} }
], ],
@ -207,11 +249,11 @@
"zIndex": 4 "zIndex": 4
}, },
{ {
"id": "(handler -- )[0]", "id": "(a -- )[0]",
"src": "handler", "src": "a",
"srcArrow": "none", "srcArrow": "none",
"srcLabel": "", "srcLabel": "",
"dst": "handler-lifeline-end-2166861706", "dst": "a-lifeline-end-2251863791",
"dstArrow": "none", "dstArrow": "none",
"dstLabel": "", "dstLabel": "",
"opacity": 1, "opacity": 1,
@ -232,11 +274,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 137.5, "x": 99,
"y": 140 "y": 140
}, },
{ {
"x": 137.5, "x": 99,
"y": 400 "y": 400
} }
], ],
@ -246,11 +288,11 @@
"zIndex": 1 "zIndex": 1
}, },
{ {
"id": "(db -- )[0]", "id": "(b -- )[0]",
"src": "db", "src": "b",
"srcArrow": "none", "srcArrow": "none",
"srcLabel": "", "srcLabel": "",
"dst": "db-lifeline-end-2675250554", "dst": "b-lifeline-end-668380428",
"dstArrow": "none", "dstArrow": "none",
"dstLabel": "", "dstLabel": "",
"opacity": 1, "opacity": 1,
@ -271,50 +313,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 388, "x": 349,
"y": 140 "y": 140
}, },
{ {
"x": 388, "x": 349,
"y": 400
}
],
"animated": false,
"tooltip": "",
"icon": null,
"zIndex": 1
},
{
"id": "(HTTP request -- )[0]",
"src": "HTTP request",
"srcArrow": "none",
"srcLabel": "",
"dst": "HTTP request-lifeline-end-1968028819",
"dstArrow": "none",
"dstLabel": "",
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "#0D32B2",
"label": "",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#676C7E",
"italic": true,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelPosition": "",
"labelPercentage": 0,
"route": [
{
"x": 638,
"y": 140
},
{
"x": 638,
"y": 400 "y": 400
} }
], ],

View file

@ -3,7 +3,7 @@
id="d2-svg" id="d2-svg"
style="background: white;" style="background: white;"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="893" height="528" viewBox="-78 -28 893 528"><style type="text/css"> width="604" height="528" viewBox="-78 -28 604 528"><style type="text/css">
<![CDATA[ <![CDATA[
.shape { .shape {
shape-rendering: geometricPrecision; shape-rendering: geometricPrecision;
@ -39,9 +39,9 @@ width="893" height="528" viewBox="-78 -28 893 528"><style type="text/css">
svgEl.setAttribute("height", height * ratio - 16); svgEl.setAttribute("height", height * ratio - 16);
} }
}); });
]]></script><g id="handler"><g class="shape" ><rect x="24" y="74" width="227" height="66" style="fill:#FFFFFF;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="137.500000" y="112.500000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">handlers (handler function)</text></g><g id="db"><g class="shape" ><rect x="313" y="74" width="150" height="66" style="fill:#EDF0FD;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="388.000000" y="112.500000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">db</text></g><g id="HTTP request"><g class="shape" ><rect x="563" y="74" width="150" height="66" style="fill:#EDF0FD;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="638.000000" y="112.500000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">HTTP request</text></g><g id="(handler -- )[0]"><path d="M 137.500000 142.000000 L 137.500000 399.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#3348687221)"/></g><g id="(db -- )[0]"><path d="M 388.000000 142.000000 L 388.000000 399.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#3348687221)"/></g><g id="(HTTP request -- )[0]"><path d="M 638.000000 142.000000 L 638.000000 399.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#3348687221)"/></g><g id="HTTP request.handlers"><g class="shape" ><rect x="632" y="254" width="12" height="80" style="fill:#E3E9FD;stroke:#0D32B2;stroke-width:2;" /></g></g><g id="(HTTP request.handlers -&gt; db)[0]"><marker id="mk-3990223579" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="#0D32B2" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 630.000000 270.000000 L 392.000000 270.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;" marker-end="url(#mk-3990223579)" mask="url(#3348687221)"/></g><mask id="3348687221" maskUnits="userSpaceOnUse" x="-100" y="-100" width="893" height="528"> ]]></script><g id="a"><g class="shape" ><rect x="24" y="74" width="150" height="66" style="fill:#EDF0FD;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="99.000000" y="112.500000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">a</text></g><g id="b"><g class="shape" ><rect x="274" y="74" width="150" height="66" style="fill:#FFFFFF;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="349.000000" y="112.500000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">b</text></g><g id="(a -- )[0]"><path d="M 99.000000 142.000000 L 99.000000 399.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#3139491304)"/></g><g id="(b -- )[0]"><path d="M 349.000000 142.000000 L 349.000000 399.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#3139491304)"/></g><g id="group"><g class="shape blend" ><rect x="25" y="206" width="0" height="0" style="fill:#DEE1EB;stroke:#0D32B2;stroke-width:0;" /></g><text class="text" x="50.000000" y="227.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">group</text></g><g id="group.inner_group"><g class="shape" ><rect x="49" y="230" width="0" height="0" style="fill:#E3E9FD;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="95.000000" y="251.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">inner_group</text></g><g id="group.inner_group.b"><g class="shape" ><rect x="9223372036854775807" y="9223372036854775807" width="-9223372036854775808" height="-9223372036854775808" style="fill:#EDF0FD;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="9223372036854775808.000000" y="9223372036854775808.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">b</text></g><g id="(a -&gt; b)[0]"><marker id="mk-3990223579" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="#0D32B2" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 101.000000 270.000000 L 345.000000 270.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;" marker-end="url(#mk-3990223579)" mask="url(#3139491304)"/></g><mask id="3139491304" maskUnits="userSpaceOnUse" x="-100" y="-100" width="604" height="528">
<rect x="-100" y="-100" width="893" height="528" fill="white"></rect> <rect x="-100" y="-100" width="604" height="528" fill="white"></rect>
<rect x="30.000000" y="211.000000" width="40" height="16" fill="black"></rect>
</mask><style type="text/css"><![CDATA[ </mask><style type="text/css"><![CDATA[
.text { .text {
font-family: "font-regular"; font-family: "font-regular";

Before

Width:  |  Height:  |  Size: 327 KiB

After

Width:  |  Height:  |  Size: 327 KiB

View file

@ -3,13 +3,177 @@
"fontFamily": "SourceSansPro", "fontFamily": "SourceSansPro",
"shapes": [ "shapes": [
{ {
"id": "handler", "id": "a",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 24, "x": 24,
"y": 74 "y": 74
}, },
"width": 227, "width": 150,
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "a",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 7,
"labelHeight": 21,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
},
{
"id": "group",
"type": "rectangle",
"pos": {
"x": 25,
"y": 206
},
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 0,
"borderRadius": 0,
"fill": "#DEE1EB",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": true,
"fields": null,
"methods": null,
"columns": null,
"label": "group",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 40,
"labelHeight": 21,
"labelPosition": "INSIDE_TOP_LEFT",
"zIndex": 3,
"level": 1
},
{
"id": "group.inner_group",
"type": "rectangle",
"pos": {
"x": 49,
"y": 230
},
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#E3E9FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "inner_group",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 82,
"labelHeight": 21,
"labelPosition": "INSIDE_TOP_LEFT",
"zIndex": 3,
"level": 2
},
{
"id": "group.inner_group.b",
"type": "rectangle",
"pos": {
"x": 9223372036854775807,
"y": 9223372036854775807
},
"width": -9223372036854775808,
"height": -9223372036854775808,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "b",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 8,
"labelHeight": 21,
"labelPosition": "INSIDE_TOP_LEFT",
"zIndex": 3,
"level": 3
},
{
"id": "b",
"type": "rectangle",
"pos": {
"x": 274,
"y": 74
},
"width": 150,
"height": 66, "height": 66,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -29,7 +193,7 @@
"fields": null, "fields": null,
"methods": null, "methods": null,
"columns": null, "columns": null,
"label": "handlers (handler function)", "label": "b",
"fontSize": 16, "fontSize": 16,
"fontFamily": "DEFAULT", "fontFamily": "DEFAULT",
"language": "", "language": "",
@ -37,142 +201,20 @@
"italic": false, "italic": false,
"bold": false, "bold": false,
"underline": false, "underline": false,
"labelWidth": 182, "labelWidth": 8,
"labelHeight": 21, "labelHeight": 21,
"labelPosition": "INSIDE_MIDDLE_CENTER", "labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0, "zIndex": 0,
"level": 1 "level": 1
},
{
"id": "db",
"type": "rectangle",
"pos": {
"x": 313,
"y": 74
},
"width": 150,
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "db",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 18,
"labelHeight": 21,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
},
{
"id": "HTTP request",
"type": "rectangle",
"pos": {
"x": 563,
"y": 74
},
"width": 150,
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "HTTP request",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 91,
"labelHeight": 21,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
},
{
"id": "HTTP request.handlers",
"type": "rectangle",
"pos": {
"x": 632,
"y": 254
},
"width": 12,
"height": 80,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#E3E9FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 58,
"labelHeight": 21,
"zIndex": 2,
"level": 2
} }
], ],
"connections": [ "connections": [
{ {
"id": "(HTTP request.handlers -> db)[0]", "id": "(a -> b)[0]",
"src": "HTTP request.handlers", "src": "a",
"srcArrow": "none", "srcArrow": "none",
"srcLabel": "", "srcLabel": "",
"dst": "db", "dst": "b",
"dstArrow": "triangle", "dstArrow": "triangle",
"dstLabel": "", "dstLabel": "",
"opacity": 1, "opacity": 1,
@ -193,11 +235,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 632, "x": 99,
"y": 270 "y": 270
}, },
{ {
"x": 388, "x": 349,
"y": 270 "y": 270
} }
], ],
@ -207,11 +249,11 @@
"zIndex": 4 "zIndex": 4
}, },
{ {
"id": "(handler -- )[0]", "id": "(a -- )[0]",
"src": "handler", "src": "a",
"srcArrow": "none", "srcArrow": "none",
"srcLabel": "", "srcLabel": "",
"dst": "handler-lifeline-end-2166861706", "dst": "a-lifeline-end-2251863791",
"dstArrow": "none", "dstArrow": "none",
"dstLabel": "", "dstLabel": "",
"opacity": 1, "opacity": 1,
@ -232,11 +274,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 137.5, "x": 99,
"y": 140 "y": 140
}, },
{ {
"x": 137.5, "x": 99,
"y": 400 "y": 400
} }
], ],
@ -246,11 +288,11 @@
"zIndex": 1 "zIndex": 1
}, },
{ {
"id": "(db -- )[0]", "id": "(b -- )[0]",
"src": "db", "src": "b",
"srcArrow": "none", "srcArrow": "none",
"srcLabel": "", "srcLabel": "",
"dst": "db-lifeline-end-2675250554", "dst": "b-lifeline-end-668380428",
"dstArrow": "none", "dstArrow": "none",
"dstLabel": "", "dstLabel": "",
"opacity": 1, "opacity": 1,
@ -271,50 +313,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 388, "x": 349,
"y": 140 "y": 140
}, },
{ {
"x": 388, "x": 349,
"y": 400
}
],
"animated": false,
"tooltip": "",
"icon": null,
"zIndex": 1
},
{
"id": "(HTTP request -- )[0]",
"src": "HTTP request",
"srcArrow": "none",
"srcLabel": "",
"dst": "HTTP request-lifeline-end-1968028819",
"dstArrow": "none",
"dstLabel": "",
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "#0D32B2",
"label": "",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#676C7E",
"italic": true,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelPosition": "",
"labelPercentage": 0,
"route": [
{
"x": 638,
"y": 140
},
{
"x": 638,
"y": 400 "y": 400
} }
], ],

View file

@ -3,7 +3,7 @@
id="d2-svg" id="d2-svg"
style="background: white;" style="background: white;"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="893" height="528" viewBox="-78 -28 893 528"><style type="text/css"> width="604" height="528" viewBox="-78 -28 604 528"><style type="text/css">
<![CDATA[ <![CDATA[
.shape { .shape {
shape-rendering: geometricPrecision; shape-rendering: geometricPrecision;
@ -39,9 +39,9 @@ width="893" height="528" viewBox="-78 -28 893 528"><style type="text/css">
svgEl.setAttribute("height", height * ratio - 16); svgEl.setAttribute("height", height * ratio - 16);
} }
}); });
]]></script><g id="handler"><g class="shape" ><rect x="24" y="74" width="227" height="66" style="fill:#FFFFFF;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="137.500000" y="112.500000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">handlers (handler function)</text></g><g id="db"><g class="shape" ><rect x="313" y="74" width="150" height="66" style="fill:#EDF0FD;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="388.000000" y="112.500000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">db</text></g><g id="HTTP request"><g class="shape" ><rect x="563" y="74" width="150" height="66" style="fill:#EDF0FD;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="638.000000" y="112.500000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">HTTP request</text></g><g id="(handler -- )[0]"><path d="M 137.500000 142.000000 L 137.500000 399.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#3348687221)"/></g><g id="(db -- )[0]"><path d="M 388.000000 142.000000 L 388.000000 399.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#3348687221)"/></g><g id="(HTTP request -- )[0]"><path d="M 638.000000 142.000000 L 638.000000 399.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#3348687221)"/></g><g id="HTTP request.handlers"><g class="shape" ><rect x="632" y="254" width="12" height="80" style="fill:#E3E9FD;stroke:#0D32B2;stroke-width:2;" /></g></g><g id="(HTTP request.handlers -&gt; db)[0]"><marker id="mk-3990223579" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="#0D32B2" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 630.000000 270.000000 L 392.000000 270.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;" marker-end="url(#mk-3990223579)" mask="url(#3348687221)"/></g><mask id="3348687221" maskUnits="userSpaceOnUse" x="-100" y="-100" width="893" height="528"> ]]></script><g id="a"><g class="shape" ><rect x="24" y="74" width="150" height="66" style="fill:#EDF0FD;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="99.000000" y="112.500000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">a</text></g><g id="b"><g class="shape" ><rect x="274" y="74" width="150" height="66" style="fill:#FFFFFF;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="349.000000" y="112.500000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">b</text></g><g id="(a -- )[0]"><path d="M 99.000000 142.000000 L 99.000000 399.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#3139491304)"/></g><g id="(b -- )[0]"><path d="M 349.000000 142.000000 L 349.000000 399.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#3139491304)"/></g><g id="group"><g class="shape blend" ><rect x="25" y="206" width="0" height="0" style="fill:#DEE1EB;stroke:#0D32B2;stroke-width:0;" /></g><text class="text" x="50.000000" y="227.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">group</text></g><g id="group.inner_group"><g class="shape" ><rect x="49" y="230" width="0" height="0" style="fill:#E3E9FD;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="95.000000" y="251.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">inner_group</text></g><g id="group.inner_group.b"><g class="shape" ><rect x="9223372036854775807" y="9223372036854775807" width="-9223372036854775808" height="-9223372036854775808" style="fill:#EDF0FD;stroke:#0D32B2;stroke-width:2;" /></g><text class="text" x="9223372036854775808.000000" y="9223372036854775808.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">b</text></g><g id="(a -&gt; b)[0]"><marker id="mk-3990223579" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="#0D32B2" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 101.000000 270.000000 L 345.000000 270.000000" class="connection" style="fill:none;stroke:#0D32B2;stroke-width:2;" marker-end="url(#mk-3990223579)" mask="url(#3139491304)"/></g><mask id="3139491304" maskUnits="userSpaceOnUse" x="-100" y="-100" width="604" height="528">
<rect x="-100" y="-100" width="893" height="528" fill="white"></rect> <rect x="-100" y="-100" width="604" height="528" fill="white"></rect>
<rect x="30.000000" y="211.000000" width="40" height="16" fill="black"></rect>
</mask><style type="text/css"><![CDATA[ </mask><style type="text/css"><![CDATA[
.text { .text {
font-family: "font-regular"; font-family: "font-regular";

Before

Width:  |  Height:  |  Size: 327 KiB

After

Width:  |  Height:  |  Size: 327 KiB