From 3ee4eb5928f5190c81054409888b6b748509f069 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Mon, 15 Apr 2024 22:10:50 -0700 Subject: [PATCH] fix again --- ci/release/changelogs/next.md | 2 ++ d2plugin/exec.go | 4 ++-- d2plugin/plugin.go | 4 ++-- d2plugin/serve.go | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index f3c0d2a77..432f3a3c3 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -3,3 +3,5 @@ #### Improvements 🧹 #### Bugfixes ⛑️ + +- Fix executable plugins that implement standalone router [#1910](https://github.com/terrastruct/d2/pull/1910) diff --git a/d2plugin/exec.go b/d2plugin/exec.go index a6776feed..fd3856b11 100644 --- a/d2plugin/exec.go +++ b/d2plugin/exec.go @@ -223,8 +223,8 @@ func (p *execPlugin) RouteEdges(ctx context.Context, g *d2graph.Graph, edges []* } in := routeEdgesInput{ - g: graphBytes, - gedges: graphBytes2, + G: graphBytes, + GEdges: graphBytes2, } b, err := json.Marshal(in) diff --git a/d2plugin/plugin.go b/d2plugin/plugin.go index 070706219..6708e5e03 100644 --- a/d2plugin/plugin.go +++ b/d2plugin/plugin.go @@ -86,8 +86,8 @@ type RoutingPlugin interface { } type routeEdgesInput struct { - g []byte - gedges []byte + G []byte `json:"g"` + GEdges []byte `json:"gEdges"` } // PluginInfo is the current info information of a plugin. diff --git a/d2plugin/serve.go b/d2plugin/serve.go index 9a9c34aa2..c975217ce 100644 --- a/d2plugin/serve.go +++ b/d2plugin/serve.go @@ -157,12 +157,12 @@ func routeEdges(ctx context.Context, p RoutingPlugin, ms *xmain.State) error { } var g d2graph.Graph - if err := d2graph.DeserializeGraph(in.g, &g); err != nil { + if err := d2graph.DeserializeGraph(in.G, &g); err != nil { return fmt.Errorf("failed to unmarshal input graph to graph: %s", in) } var gedges d2graph.Graph - if err := d2graph.DeserializeGraph(in.gedges, &gedges); err != nil { + if err := d2graph.DeserializeGraph(in.GEdges, &gedges); err != nil { return fmt.Errorf("failed to unmarshal input edges graph to graph: %s", in) }