Merge pull request #1912 from alixander/fix-routing-plugin-3

fix routing plugin
This commit is contained in:
Alexander Wang 2024-04-15 22:16:47 -07:00 committed by GitHub
commit b64ed87674
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 6 deletions

View file

@ -3,3 +3,5 @@
#### Improvements 🧹
#### Bugfixes ⛑️
- Fix executable plugins that implement standalone router [#1910](https://github.com/terrastruct/d2/pull/1910)

View file

@ -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)

View file

@ -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.

View file

@ -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)
}