feat: add deterministic Diagram IR v2 authoring

This commit is contained in:
2026-09-03 10:05:29 +00:00
parent 305006c8cb
commit 50a07b90a9
31 changed files with 2108 additions and 98 deletions
+122
View File
@@ -0,0 +1,122 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://gitea.lego-cloud.eu/home-v1-skills-code-agent/drawio-main/raw/branch/main/schemas/diagram-ir-v2.schema.json",
"title": "drawio-main Diagram IR v2",
"type": "object",
"required": ["version", "pages"],
"properties": {
"version": { "const": 2 },
"title": { "type": "string" },
"pages": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/page" }
},
"provenance": { "type": "object" },
"assets": { "type": "object" },
"theme": { "type": "string" },
"properties": { "type": "object" },
"extensions": { "type": "object" }
},
"additionalProperties": false,
"$defs": {
"safeId": {
"type": "string",
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]*$",
"not": { "enum": ["0", "1"] }
},
"point": {
"type": "object",
"required": ["x", "y"],
"properties": {
"x": { "type": "number" },
"y": { "type": "number" }
},
"additionalProperties": false
},
"geometry": {
"type": "object",
"required": ["x", "y", "width", "height"],
"properties": {
"x": { "type": "number" },
"y": { "type": "number" },
"width": { "type": "number", "exclusiveMinimum": 0 },
"height": { "type": "number", "exclusiveMinimum": 0 }
},
"additionalProperties": false
},
"layout": {
"type": "object",
"required": ["type"],
"properties": {
"type": { "enum": ["linear", "layered", "tree", "grid", "manual"] },
"direction": { "enum": ["horizontal", "vertical"] },
"gridSize": { "type": "number", "exclusiveMinimum": 0 },
"nodeGap": { "type": "number", "exclusiveMinimum": 0 },
"layerGap": { "type": "number", "exclusiveMinimum": 0 }
},
"additionalProperties": false
},
"node": {
"type": "object",
"required": ["id", "label"],
"properties": {
"id": { "$ref": "#/$defs/safeId" },
"label": { "type": "string", "minLength": 1, "pattern": "\\S" },
"kind": { "type": "string" },
"parentId": { "$ref": "#/$defs/safeId" },
"width": { "type": "number", "exclusiveMinimum": 0 },
"height": { "type": "number", "exclusiveMinimum": 0 },
"geometry": { "$ref": "#/$defs/geometry" },
"style": { "type": "string" },
"properties": { "type": "object" },
"provenance": { "type": "object" },
"extensions": { "type": "object" }
},
"additionalProperties": false
},
"edge": {
"type": "object",
"required": ["id", "source", "target"],
"properties": {
"id": { "$ref": "#/$defs/safeId" },
"source": { "$ref": "#/$defs/safeId" },
"target": { "$ref": "#/$defs/safeId" },
"label": { "type": "string" },
"kind": { "type": "string" },
"style": { "type": "string" },
"waypoints": {
"type": "array",
"items": { "$ref": "#/$defs/point" }
},
"properties": { "type": "object" },
"provenance": { "type": "object" },
"extensions": { "type": "object" }
},
"additionalProperties": false
},
"page": {
"type": "object",
"required": ["id", "title", "nodes", "edges"],
"properties": {
"id": { "$ref": "#/$defs/safeId" },
"title": { "type": "string", "minLength": 1, "pattern": "\\S" },
"nodes": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/node" }
},
"edges": {
"type": "array",
"items": { "$ref": "#/$defs/edge" }
},
"layout": { "$ref": "#/$defs/layout" },
"width": { "type": "number", "exclusiveMinimum": 0 },
"height": { "type": "number", "exclusiveMinimum": 0 },
"properties": { "type": "object" },
"extensions": { "type": "object" }
},
"additionalProperties": false
}
}
}