Skip to content

Commit

Permalink
remove unnecessary possibleType field on edge
Browse files Browse the repository at this point in the history
  • Loading branch information
benweint committed Jun 4, 2024
1 parent a119b1d commit 563fb04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
11 changes: 5 additions & 6 deletions pkg/graph/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ const (
)

type edge struct {
src *model.Definition
dst *model.Definition
kind edgeKind
field *model.FieldDefinition
argument *model.ArgumentDefinition
possibleType string
kind edgeKind
src *model.Definition
dst *model.Definition
field *model.FieldDefinition // only set for fields representing eges or arguments
argument *model.ArgumentDefinition // only set for fields representing arguments
}
9 changes: 4 additions & 5 deletions pkg/graph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@ func (g *Graph) makeUnionEdges(t *model.Definition) []*edge {
continue
}
result = append(result, &edge{
src: srcNode,
dst: dstNode,
kind: edgeKindPossibleType,
possibleType: possibleType,
src: srcNode,
dst: dstNode,
kind: edgeKindPossibleType,
})
}
return result
Expand Down Expand Up @@ -269,7 +268,7 @@ func (g *Graph) buildEdgeDefs() []string {
case edgeKindArgument:
srcPortSuffix = ":" + portNameForArgument(edge.field.Name, edge.argument.Name)
case edgeKindPossibleType:
srcPortSuffix = ":" + portName(edge.possibleType)
srcPortSuffix = ":" + portName(edge.dst.Name)
}

result = append(result, fmt.Sprintf(" %s%s -> %s%s", nodeID(edge.src), srcPortSuffix, nodeID(edge.dst), dstPortSuffix))
Expand Down

0 comments on commit 563fb04

Please sign in to comment.