From d7e8b8136aa22301ae3a448c38024f1d049f3d1a Mon Sep 17 00:00:00 2001 From: "Emden R. Gansner" Date: Wed, 17 Aug 2016 20:36:28 -0400 Subject: [PATCH] Add schema for dot output in json format. --- doc/infosrc/graphviz_json_schema.json | 420 ++++++++++++++++++++++++++ 1 file changed, 420 insertions(+) create mode 100644 doc/infosrc/graphviz_json_schema.json diff --git a/doc/infosrc/graphviz_json_schema.json b/doc/infosrc/graphviz_json_schema.json new file mode 100644 index 000000000..2503e5e87 --- /dev/null +++ b/doc/infosrc/graphviz_json_schema.json @@ -0,0 +1,420 @@ +{ + "title": "Graphviz JSON", + "description": "JSON representation of a graph encoding xdot attributes", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The graph name" + }, + "directed": { + "type": "boolean", + "description": "True if the graph is directed" + }, + "strict": { + "type": "boolean", + "description": "True if the graph is strict" + }, + "_subgraph_cnt": { + "type": "integer" + }, + "objects": { + "type": "array", + "items": { "$ref": "#/definitions/metanode" } + }, + "edges": { + "type": "array", + "items": { + "$ref": "#/definitions/edge" + } + }, + "_draw_": { + "$ref": "#/definitions/drawops" + }, + "_ldraw_": { + "$ref": "#/definitions/drawops" + }, + "additionalProperties": { + "type": "string" + } + }, + "required": [ + "name", + "directed", + "strict", + "_subgraph_cnt" + ], + "definitions": { + "edge": { + "title": "edge", + "type": "object", + "properties": { + "_gvid": { + "type": "integer" + }, + "tail": { + "type": "integer", + "description": "_gvid of tail node" + }, + "head": { + "type": "integer", + "description": "_gvid of tail head" + }, + "_draw_": { + "$ref": "#/definitions/drawops" + }, + "_ldraw_": { + "$ref": "#/definitions/drawops" + }, + "_hdraw_": { + "$ref": "#/definitions/drawops" + }, + "_tdraw_": { + "$ref": "#/definitions/drawops" + }, + "_hldraw_": { + "$ref": "#/definitions/drawops" + }, + "_tldraw_": { + "$ref": "#/definitions/drawops" + }, + "additionalProperties": { + "type": "string" + } + }, + "required": [ + "_gvid", + "tail", + "head" + ] + }, + "metanode": { + "title": "nor or cluster subgraph", + "type": "object", + "properties": { + "_gvid": { + "type": "integer" + }, + "name": { + "type": "string", + "description": "The node or cluster name" + }, + "subgraphs": { + "type": "array", + "items": { + "type": "integer" + }, + "description": "index of a child cluster" + }, + "nodes": { + "type": "array", + "items": { + "type": "integer" + }, + "description": "index of a node in this cluster" + }, + "edges": { + "type": "array", + "items": { + "type": "integer" + }, + "description": "index of an edge in this cluster" + }, + "_draw_": { + "$ref": "#/definitions/drawops" + }, + "_ldraw_": { + "$ref": "#/definitions/drawops" + }, + "additionalProperties": { + "type": "string" + } + }, + "required": [ + "_gvid", + "name" + ] + }, + "drawops": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/definitions/ellipse" + }, + { + "$ref": "#/definitions/polygon" + }, + { + "$ref": "#/definitions/polyline" + }, + { + "$ref": "#/definitions/bspline" + }, + { + "$ref": "#/definitions/text" + }, + { + "$ref": "#/definitions/font_style" + }, + { + "$ref": "#/definitions/drawcolor" + }, + { + "$ref": "#/definitions/font" + }, + { + "$ref": "#/definitions/style" + } + ] + } + }, + "ellipse": { + "type": "object", + "properties": { + "op": { + "type": "string", + "pattern": "[eE]" + }, + "rect": { + "$ref": "#/definitions/rectangle" + } + }, + "required": [ + "op", + "rect" + ] + }, + "polygon": { + "type": "object", + "properties": { + "op": { + "type": "string", + "pattern": "[pP]" + }, + "points": { + "$ref": "#/definitions/pointlist" + } + }, + "required": [ + "op", + "points" + ] + }, + "polyline": { + "type": "object", + "properties": { + "op": { + "type": "string", + "pattern": "L" + }, + "points": { + "$ref": "#/definitions/pointlist" + } + }, + "required": [ + "op", + "points" + ] + }, + "bspline": { + "type": "object", + "properties": { + "op": { + "type": "string", + "pattern": "[bB]" + }, + "points": { + "$ref": "#/definitions/pointlist" + } + }, + "required": [ + "op", + "points" + ] + }, + "text": { + "type": "object", + "properties": { + "op": { + "type": "string", + "pattern": "T" + }, + "pt": { + "$ref": "#/definitions/point" + }, + "align": { + "type": "string", + "pattern": "[lcr]" + }, + "text": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "op", + "pt", + "align", + "text", + "width" + ] + }, + "font_style": { + "type": "object", + "properties": { + "op": { + "type": "string", + "pattern": "t" + }, + "fontchar": { + "type": "integer", + "minimum": 0, + "maximum": 127 + } + }, + "required": [ + "op", + "fontchar" + ] + }, + "drawcolor": { + "type": "object", + "properties": { + "op": { + "type": "string", + "pattern": "[cC]" + }, + "p0": { + "oneOf": [ + { + "$ref": "#/definitions/point" + }, + { + "$ref": "#/definitions/point3" + } + ] + }, + "p1": { + "oneOf": [ + { + "$ref": "#/definitions/point" + }, + { + "$ref": "#/definitions/point3" + } + ] + }, + "grad": { + "type": "string", + "enum": [ + "none", + "linear", + "radial" + ] + }, + "color": { + "$ref": "#/definitions/color" + }, + "stops": { + "type": "array", + "items": { + "$ref": "#/definitions/stop" + } + } + }, + "required": [ + "op", + "grad" + ] + }, + "font": { + "type": "object", + "properties": { + "op": { + "type": "string", + "pattern": "F" + }, + "size": { + "type": "number", + "minimum": 0 + }, + "face": { + "type": "string" + } + }, + "required": [ + "op", + "size", + "face" + ] + }, + "style": { + "type": "object", + "properties": { + "op": { + "type": "string", + "pattern": "S" + }, + "style": { + "type": "string" + } + }, + "required": [ + "op", + "style" + ] + }, + "pointlist": { + "type": "array", + "items": { + "$ref": "#/definitions/point" + } + }, + "point": { + "type": "array", + "items": { + "type": "number" + }, + "maxItems": 2, + "minItems": 2 + }, + "point3": { + "type": "array", + "items": { + "type": "number" + }, + "maxItems": 3, + "minItems": 3 + }, + "rectangle": { + "type": "array", + "items": { + "type": "number" + }, + "maxItems": 4, + "minItems": 4 + }, + "color": { + "type": "string", + "pattern": "(#[0-9a-f]*)|(#[0-9a-f]{8})" + }, + "stop": { + "type": "object", + "properties": { + "frac": { + "type": "number" + }, + "color": { + "$ref": "#/definitions/color" + } + }, + "required": [ + "frac", + "color" + ] + } + } +} -- 2.40.0