// Diagram service for rendering diagrams edition = "2023"; package workflows.v1; import "buf/validate/validate.proto"; option features.field_presence = IMPLICIT; // Request to render a diagram message RenderDiagramRequest { // The diagram graph in the D2 syntax string diagram = 1; // The options for rendering the diagram RenderOptions render_options = 2; } // Options for rendering the diagram message RenderOptions { // The layout to use for rendering the diagram: https://d2lang.com/tour/layouts/. // "dagre" or "elk". Defaults to "dagre" string layout = 1 [(buf.validate.field).string = { in: [ "", // if not set, defaults to "dagre" "dagre", "elk" ] }]; // The D2 theme to use when rendering the diagram: https://d2lang.com/tour/themes/ int64 theme_id = 2 [features.field_presence = EXPLICIT]; // Whether to render the diagram in a sketchy (hand-drawn) style bool sketchy = 3; // The padding around the diagram int64 padding = 4; // Set explicitly the direction of the diagram: https://d2lang.com/tour/layouts/#direction. string direction = 5 [(buf.validate.field).string = { in: [ "", // if not set, defaults to the d2 default, which is "down" "up", "down", "right", "left" ] }]; } // A rendered diagram message Diagram { bytes svg = 1; } // The diagram service service DiagramService { rpc Render(RenderDiagramRequest) returns (Diagram); }