Add JSON GraphRenderer + !graph --format flag#231
Merged
Conversation
Code Coverage
|
ryannedolan
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a second
GraphRendererimplementation —JsonGraphRenderer— alongside theexisting Mermaid renderer, and exposes renderer selection through the
!graphCLIcommand via a new
--formatflag. This gives programmatic consumers a structured,parse-friendly view of the same pipeline topology the Mermaid renderer draws, without
scraping Mermaid text.
Builds on the pluggable graph SPI introduced in #222. No changes to the graph data
model (
PipelineGraph/GraphNode/GraphEdge) or providers — this is purely a newrenderer plus CLI plumbing.
JSON is more easily sent over the wire and rendered by web UIs.
What's included
hoptimator-graphJsonGraphRenderer(format() == "json") that serializes aPipelineGraphto astable JSON document. Registered via
META-INF/servicesso it's discovered throughGraphServiceexactly like the Mermaid renderer.jackson-databinddependency (used for correct escaping / tree building).hoptimator-cli!graph <identifier> [--depth N] [--format mermaid|json]. Default remainsmermaid— existing behavior and integration scripts are unchanged.--formatdispatches through
GraphService.render(graph, format)to the matching SPI.GraphService.availableFormats()).%%comment) is now only emitted forMermaid output, so JSON output stays valid/parseable.
Docs
docs/user-guide/sql-cli.md: documents--formatwith a JSON example.docs/extending/index.md: notes that both Mermaid and JSON renderers now ship.JSON format
{ "root": "<GraphNode.id of the focal node>", "orientation": "LR" | "TD", // TD when the root is a LogicalTable, else LR "nodes": [ { "id", "kind", "displayName", ...kind-specific fields }, // PIPELINE: name, jobKind?, engine?, executionMode? // VIEW: name, materialized // LOGICAL_TABLE: name, tiers { tier -> database } // TRIGGER: name, schedule?, paused, jobTemplateName?, containerName? // EXTERNAL: database, path[] ], "edges": [ { "from", "to", "type" } ] // includes OWNER_OF }