{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/zindex-ai/json-schema/zindex-ai-scene-document-schema.json",
  "title": "SceneDocument",
  "description": "A DSP scene document containing the scene definition, elements, and optional styles, constraints, palette, layoutStrategy, diagramFamily, and extensions.",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/zindex-ai-openapi.json#/components/schemas/SceneDocument",
  "type": "object",
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "0.1"
    },
    "scene": {
      "type": "object",
      "description": "Scene metadata and canvas configuration. Canvas dimensions are a minimum per axis: when content exceeds the declared dimensions, the engine auto-extends the canvas to fit. The engine never silently clips. When the engine lays out every node (a new diagram whose nodes have no positions, autoLayout without elements, or a new layoutStrategy or diagramFamily, unless members of a pool, lane or fragment with its own layout, or of a frame in an org chart or network, keep their positions), it also auto-spreads the nodes around their centroid to fill a declared canvas larger than node spacing needs, and caps an axis declared more than 30% larger than the comfortable centered-content size at content x 1.4. This is the only path where the engine reduces the canvas below a declared dimension, and the size it picks is saved with the diagram. Supply absolute coordinates on any node of a new diagram, or an absolute layout on a text, an image or a frame, to keep the declared size. After the first save nodes keep their positions, so a larger canvas set with updateScene adds room on the right and at the bottom; send autoLayout to spread the nodes into it. Neither growing nor tightening comes back as a warning.",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "brief": {
          "type": "string",
          "maxLength": 1000,
          "description": "Context kept with the diagram for the next agent: what it shows, conventions to keep, decisions made. Versioned with the diagram."
        },
        "lang": {
          "type": "string",
          "description": "The language the diagram's text is in, a BCP 47 language tag such as ja, ko, zh-Hans, zh-Hant or zh-HK. When it names Chinese, Japanese or Korean, it picks the letterforms of Chinese characters. Without it, or with another language, the forms are inferred from the text: kana is Japanese, Hangul is Korean, and other Chinese characters are Simplified Chinese, Traditional Chinese or Japanese by the forms they use. A diagram whose Chinese characters Simplified Chinese, Traditional Chinese and Japanese all share is read as Simplified Chinese. Japanese written without kana can read as Traditional Chinese. Set lang when you know the language. Hong Kong forms need zh-HK. A tag that isn't well formed is refused with LANG_INVALID. updateScene's lang sets it, and null removes it."
        },
        "units": {
          "type": "string",
          "enum": [
            "px"
          ]
        },
        "canvas": {
          "type": "object",
          "description": "Canvas dimensions. Both width and height are a minimum: the engine grows past them to fit content. The engine may also tighten either axis BELOW declared when it lays out every node (a new diagram whose nodes have no positions, autoLayout without elements, or a new layoutStrategy or diagramFamily, unless members of a pool, lane or fragment with its own layout, or of a frame in an org chart or network, keep their positions) AND no text, image or frame has an absolute layout AND the declared dimension on that axis exceeds the comfortable centered-content size by more than 30% - to avoid rendering with excessive whitespace. The size it picks is saved with the diagram. Neither change comes back as a warning. width/height are optional - the canonical scene.schema.json marks them so, and the runtime computes content-derived dimensions when they are absent.",
          "properties": {
            "width": {
              "type": "number"
            },
            "height": {
              "type": "number"
            },
            "background": {
              "type": "string",
              "description": "CSS color value: hex (3, 4, 6 or 8 digits), rgb(), hsl(), hwb(), lab(), lch(), oklch(), oklab(), color() in a predefined space, a CSS named color, or var(--x, <color>), read by its fallback; the SVG writes it in a form every viewer reads (hex or rgba() where needed); a translucent one counts as it shows over white. When set to a dark color and no render `theme` is passed, the renderer auto-selects the dark theme so strokes / labels remain legible. Use `palette.background` to override the painted rect color without affecting theme selection. Whether a dark preview adapts the scene's colors is decided by `palette.background` when set, otherwise by this color: a dark one makes the scene a dark design, drawn as written except a light container (https://zindex.ai/docs/reference/rendering/#adaptive-colors)."
            }
          },
          "required": []
        }
      }
    },
    "elements": {
      "type": "array",
      "description": "Array of scene elements (nodes, edges, groups, frames, text, images, guides)",
      "items": {
        "$ref": "#/$defs/Element"
      }
    },
    "styles": {
      "type": "object",
      "description": "Named style definitions that elements can reference",
      "additionalProperties": true
    },
    "assets": {
      "type": "object",
      "description": "The files image elements show, by ID: each { kind: \"image\", mimeType, uri }, the uri a data: URI. updateScene's assets adds or replaces them in an edit.",
      "additionalProperties": {
        "type": "object"
      }
    },
    "constraints": {
      "type": "array",
      "description": "Layout constraints. 10 types: align, distribute, sameSize, stack, centerIn, contain, grid, minGap, noOverlap, order. The order constraint enforces hard spatial relationships when the engine places nodes (e.g. source leftOf target, source above target, sameRank); one added with addConstraint places its two nodes again when they're out of order. The other types apply on every layout. A constraint's id is optional and unique when given.",
      "items": {
        "type": "object"
      }
    },
    "diagramFamily": {
      "type": "string",
      "enum": [
        "architecture",
        "flowchart",
        "workflow",
        "entityRelationship",
        "sequence",
        "network",
        "orgchart",
        "uiflow"
      ],
      "description": "Diagram family declaration. Technically optional in the schema but effectively load-bearing: gates family-specific validation, layout, and rendering behavior. Without it the diagram is drawn as an architecture diagram, and nothing warns you. Always declare on every scene."
    },
    "layoutStrategy": {
      "type": "object",
      "description": "Optional: how the engine places nodes that have no layout. The engine picks its method from diagramFamily; the layered layout (architecture, flowchart, workflow, entityRelationship, uiflow, and no family) reads these fields, and org charts (top to bottom), network and sequence diagrams don't. Changing it with updateScene places every node again. nodeSpacing and rankSpacing are the spacing the engine aims for, not minimums: laying out every node, it also tries tighter and wider spacings and keeps the layout that scores best.",
      "properties": {
        "direction": {
          "type": "string",
          "enum": [
            "TB",
            "BT",
            "LR",
            "RL"
          ],
          "default": "LR",
          "description": "Layout direction. The default is LR, and TB for flowchart and orgchart. With AWS's groups in an architecture diagram, or one with no family, an explicit LR draws Availability Zones as rows and subnets as columns. No direction, TB, BT or RL keeps zones as columns. A saved diagram keeps its zones' arrangement until autoLayout without elements, or an updateScene that changes layoutStrategy."
        },
        "nodeSpacing": {
          "type": "number",
          "default": 30,
          "description": "Pixels the engine aims for between nodes in the same rank. Not a minimum: when it lays out every node it also tries tighter and wider spacings and keeps the layout that scores best, and it widens gaps to fill a larger canvas."
        },
        "rankSpacing": {
          "type": "number",
          "default": 80,
          "description": "Pixels the engine aims for between adjacent ranks: 80 by default, 50 in a flowchart. Not a minimum: when it lays out every node it also tries tighter and wider spacings and keeps the layout that scores best, it opens a gap wider where a label lacks room on its line, and it widens gaps to fill a larger canvas."
        }
      }
    },
    "palette": {
      "type": "object",
      "description": "Scene-level color palette that overrides theme defaults for unstyled elements. Keys: background, foreground, nodeFill, nodeStroke, edgeStroke, containerFill, containerStroke, accentPrimary, accentSecondary, mutedForeground. Element explicit styles still win. Note: palette.background does NOT trigger the canvas-aware default-theme auto-selection; only scene.canvas.background does. Set canvas.background if you want a dark canvas to also flip the default theme to dark.",
      "properties": {
        "background": {
          "type": "string"
        },
        "foreground": {
          "type": "string"
        },
        "nodeFill": {
          "type": "string"
        },
        "nodeStroke": {
          "type": "string"
        },
        "edgeStroke": {
          "type": "string"
        },
        "containerFill": {
          "type": "string"
        },
        "containerStroke": {
          "type": "string"
        },
        "accentPrimary": {
          "type": "string",
          "description": "Accent color of nodes whose style sets no accentColor: the headers and PK badges of ER tables with columns, org.person and org.role stripes, uiflow.screen and uiflow.modal title bars."
        },
        "accentSecondary": {
          "type": "string",
          "description": "Nothing draws a second accent yet, so this has no effect."
        },
        "mutedForeground": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "extensions": {
      "type": "object",
      "description": "Reserved extension point for protocol additions. Recognized keys include `showLifelineFeet` and `autonumber` (sequence diagrams only) and `autoGroup` (architecture diagrams and diagrams without a family). updateScene sets these keys and `layoutHints`, and no others.",
      "additionalProperties": true,
      "properties": {
        "showLifelineFeet": {
          "type": "boolean",
          "default": true,
          "description": "Sequence-diagram only. When true (default), the renderer draws a foot bar at the bottom of each lifeline mirroring the head (UML / PlantUML / Mermaid convention). Set to false to suppress foot bars - useful when the author has their own bottom row of shapes."
        },
        "autonumber": {
          "description": "Sequence diagrams only: numbers every drawn message, top to bottom, each time the diagram is drawn, with a numbered badge at the start of its arrow. true counts from 1 by 1; an object sets where the count starts (start) and what it goes up by (increment), each a whole number from 1 and 1 when left out. A message's own step is drawn as given and the count goes on from it, as Mermaid's autonumber with a number restarts it partway down. Notes, hidden messages and messages to or from a hidden lifeline take no number, and the count skips them. Numbers are whole numbers: write numbering such as 1.1 in the label instead. In every other family it draws nothing (AUTONUMBER_NOT_DRAWN): give the edges you want numbered a step.",
          "oneOf": [
            {
              "const": true
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "start": {
                  "type": "integer",
                  "minimum": 1,
                  "description": "The first message's number; 1 when left out."
                },
                "increment": {
                  "type": "integer",
                  "minimum": 1,
                  "description": "What each next message's number goes up by; 1 when left out."
                }
              }
            }
          ]
        },
        "autoGroup": {
          "type": "string",
          "enum": [
            "byNodeType"
          ],
          "description": "Architecture diagrams and diagrams without a family only. When set, the engine synthesizes subtle background bands grouping nodes by their `nodeType` (e.g. one band for all `service` nodes, one for `database` nodes, one for `externalSystem` nodes). Each band is labeled with the pluralized type name (\"Services\", \"Databases\", \"External Systems\"). Skipped when the scene already authors frames containing the candidate nodes (no double-wrap), when all nodes share a single `nodeType` (trivial), or when the nodes of a type are scattered (a node of another type sits between two of them in a column) or placed so that their band would overlap a frame or another band. Opt-in only; omit the field to render with no banding (existing default)."
        }
      }
    }
  },
  "required": [
    "schemaVersion",
    "scene",
    "elements"
  ],
  "$defs": {
    "AbsoluteLayout": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mode",
        "x",
        "y",
        "width",
        "height"
      ],
      "properties": {
        "mode": {
          "type": "string",
          "const": "absolute"
        },
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        },
        "width": {
          "type": "number",
          "minimum": 0,
          "description": "Pixels. For a placed node with a label or icon this is a minimum: a node whose label isn't set to wrap and needs more room is drawn wider, and the reference engine stores the width it draws when a create or an edit saves it. A label set to textStyle.wrap 'word' or 'character' keeps this width. A node whose edges dock on a smaller box than it draws (a BPMN event or gateway, a UI flow entry or exit point, an icon alone, a card a gcp.zone spans) is the exception. Its drawn size is stored only where the engine places or moves it, an edit measures it again, or its growth pushes a neighbor or a frame border. A Google Cloud card with style.multiple keeps its stored size, and the copy's room is added on every draw."
        },
        "height": {
          "type": "number",
          "minimum": 0,
          "description": "Pixels. For a placed node with a label or icon this is a minimum: a node whose label isn't set to wrap and needs more height is drawn taller, and the reference engine stores the height it draws when a create or an edit saves it. A label set to textStyle.wrap 'word' or 'character' keeps this height, and with autoSize 'content' it stays the minimum the engine grows the node from. A node whose edges dock on a smaller box than it draws is the exception. Its drawn size is stored only where the engine places or moves it, an edit measures it again, or its growth pushes a neighbor or a frame border. A Google Cloud card with style.multiple keeps its stored size, and the copy's room is added on every draw."
        },
        "rotation": {
          "type": "number",
          "default": 0,
          "description": "Kept with the layout. The reference engine doesn't rotate anything."
        },
        "autoSize": {
          "type": "string",
          "enum": [
            "content",
            "none"
          ],
          "default": "none",
          "description": "'content' sizes a node whose label wraps (textStyle.wrap 'word' or 'character') to its text: it keeps this width and gets at least the height its wrapped label and icon need, the height a TEXT_OVERFLOW warning gives, growing down from its top edge. The height here is the minimum. Nodes it grows into move down to make room, keeping the full spacing from it: the node spacing in a left-to-right flow, the rank spacing (layoutStrategy.rankSpacing) in a top-to-bottom one. No effect on a label set to 'auto' or 'none' (the engine already sizes that node to it) or on nodes that lay out their own text: org chart people and roles, UI flow screens and modals, ER tables with columns, sequence nodes, BPMN events and gateways, UI flow entry and exit points. 'none', the default, doesn't make the written width and height exact: they are a floor, so a node whose content needs more is drawn bigger, and a wrapped label that overflows its height gets a TEXT_OVERFLOW warning. For a box of one size, keep the content within it."
        }
      }
    },
    "Element": {
      "type": "object",
      "description": "A scene element. The `kind` field determines the element type. This lists the common fields; https://zindex.ai/schemas/scene.schema.json#/$defs/element has every field of every kind.",
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique element identifier"
        },
        "kind": {
          "type": "string",
          "enum": [
            "node",
            "edge",
            "group",
            "frame",
            "text",
            "image",
            "guide"
          ],
          "description": "Element type"
        },
        "nodeType": {
          "type": "string",
          "enum": [
            "generic",
            "service",
            "database",
            "queue",
            "actor",
            "note",
            "decision",
            "document",
            "process",
            "container",
            "externalSystem",
            "storage",
            "objectStorage",
            "event",
            "iconNode",
            "workflow.start",
            "workflow.end",
            "workflow.task",
            "workflow.decision",
            "workflow.gateway",
            "workflow.gatewayParallel",
            "workflow.gatewayInclusive",
            "workflow.gatewayEvent",
            "workflow.subprocess",
            "workflow.timer",
            "workflow.error",
            "workflow.intermediateTimer",
            "workflow.intermediateMessage",
            "workflow.intermediateError",
            "workflow.intermediateThrowMessage",
            "workflow.terminate",
            "workflow.messageStart",
            "workflow.messageEnd",
            "er.entity",
            "er.weakEntity",
            "er.attribute",
            "er.relationship",
            "sequence.lifeline",
            "sequence.activation",
            "sequence.actor",
            "sequence.boundary",
            "sequence.control",
            "sequence.entity",
            "sequence.database",
            "sequence.collections",
            "sequence.queue",
            "sequence.note",
            "network.server",
            "network.router",
            "network.switch",
            "network.firewall",
            "network.cloud",
            "network.client",
            "org.person",
            "org.role",
            "org.department",
            "uiflow.screen",
            "uiflow.modal",
            "uiflow.entry",
            "uiflow.exit"
          ],
          "description": "Semantic node type. Generic types, valid in any family and the types of architecture and flowchart diagrams: generic, service, database, queue, actor, note, decision, document, process, container, externalSystem, storage, objectStorage, event, iconNode. Family-namespaced types (workflow.*, er.*, sequence.*, network.*, org.*, uiflow.*) are valid in any family, but their family's rules and conventions apply only when the scene declares it. The same values as https://zindex.ai/schemas/scene.schema.json#/$defs/nodeType."
        },
        "edgeType": {
          "type": "string",
          "enum": [
            "default",
            "workflow.sequenceFlow",
            "workflow.messageFlow",
            "er.relationship",
            "er.identifying",
            "sequence.message",
            "sequence.reply",
            "sequence.create",
            "sequence.async",
            "sequence.destroy",
            "network.dataFlow",
            "network.controlFlow",
            "org.directReport",
            "org.dottedLine",
            "uiflow.navigate",
            "uiflow.back",
            "uiflow.action"
          ],
          "default": "default",
          "description": "Family-specific edge type for typed connection semantics. The same values as edgeType in https://zindex.ai/schemas/scene.schema.json."
        },
        "shape": {
          "type": "string",
          "enum": [
            "rect",
            "roundedRect",
            "ellipse",
            "diamond",
            "cylinder",
            "bucket",
            "pill",
            "hexagon",
            "parallelogram",
            "cloud",
            "box3d",
            "textBox",
            "iconBox",
            "document",
            "subroutine"
          ],
          "description": "Visual shape for nodes, in any family. document is a box with a wavy bottom, and subroutine a predefined process: a box with a line inside each side."
        },
        "label": {
          "type": "string",
          "description": "Display label"
        },
        "visible": {
          "type": "boolean",
          "default": true,
          "description": "false hides the element: it keeps its space but isn't drawn, nor any edge with an end at it. A hidden frame hides only its box and title, and a hidden group (which draws nothing) drops only its SVG `<title>`; their members stay drawn."
        },
        "layout": {
          "description": "Position and size, as in scene.schema.json: mode absolute with x, y, width and height, or mode relative with a place clause such as { \"rightOf\": \"api\", \"gap\": 40 }. Leave it out and the engine places the node next to its neighbors, around the nodes that have a layout; layoutStrategy on the scene picks how. After the first save the engine records the position here, and the size the node is drawn at except where the width and height descriptions say it isn't. It keeps the position unless a node that grows needs the room and pushes this one, a node an edit adds needs more room for its edge label than the column it joins and this node is in that column or beyond it, a task an edit adds to a lane grows the lane and this node lies past the lane, a task an edit inserts between two placed columns of a pool opens a column and this node is in that column or beyond it, a node an edit inserts in a flowchart, between two placed nodes, needs room and this node lies past it, a node an edit adds to a frame without a layout has no room there and this node lies past that frame, a layer in a stack of layers grows for a card an edit adds to it or moves into it, or an edit adds a layer (this node lies in a later layer), an edit moves this node into a layer (it stands in that layer's row), an AWS diagram's row or column grows (for a node or a spanning frame's header an edit adds, or for the room round a tier frame) or an edit moves its Region's column right to keep a labeled line into the column clear, or a Google Cloud diagram makes room for what an edit adds or a group's title it widens (its row, zone column or Region grows, or a gap between two Regions or two zone columns opens, and this node lies past it, the arrangement keeps this node over a gap, under the line that ends in it, centered on its tiers or clear of a line, or this node is joined only to a load balancer that moves to stay over the gap between two Regions, and stands in the load balancer's row or outside the boundary), an edit moves this node to another lane (it is placed again there), an edit adds or deletes a frame around it and keeping it would leave frames overlapping or a frame holding a node that isn't its member, or an added order constraint finds its two nodes the wrong way around; the autoLayout op, and a new or removed layoutStrategy or diagramFamily, place nodes again. Sequence diagrams are laid out from their messages, so their nodes stay at x 0, y 0. A layout at exactly x 0, y 0 counts as not placed.",
          "oneOf": [
            {
              "$ref": "#/$defs/AbsoluteLayout"
            },
            {
              "$ref": "#/$defs/RelativeLayout"
            }
          ]
        },
        "from": {
          "type": "object",
          "description": "Edge source (for kind=edge). elementId may reference any element kind - typically a node, but frame and group IDs are also valid targets. An edge to a frame terminates at the frame's border, on the side facing the source, straight across where the source lines up and otherwise at the side's center; useful for abstract group dependencies (e.g. an edge to a 'Regional Services' sidebar rather than to a specific service inside). On entityRelationship diagrams, set `column` to anchor the edge at a specific column row inside the entity. Set `cardinality` for an explicit Crow's Foot glyph; when it is omitted, the engine infers it (see `cardinality`).",
          "properties": {
            "elementId": {
              "type": "string"
            },
            "anchor": {
              "type": "object",
              "description": "Where this end meets its node. side alone fixes the side and leaves the place to the engine. Where the two sides face each other and their faces overlap, the engine lines the ends up so the line is straight; it also spreads ends that share a side and slides a straight line past the title of a frame it enters. offset, 0 to 1 from the side's top (left and right sides) or its left (top and bottom sides), places the end too, with the same corner distance as any end (8 px, more past a rounded corner). It is a fraction of the side as drawn, or of the smaller box a node whose edges dock on one is drawn with. The engine doesn't move it to line it up with another end, so two ends given places that don't line up take a step. An edge with edgeType workflow.sequenceFlow, uiflow.navigate, uiflow.back or uiflow.action enters a node at its center, so a side alone fixes only the face, and its line is straight only where the ends are less than 16 px off center. An anchored edge shares no trunk with other edges. Ignored, with EDGE_ANCHOR_IGNORED, on a sequence message, a self-loop or an end with a column.",
              "additionalProperties": false,
              "required": [
                "side"
              ],
              "properties": {
                "side": {
                  "type": "string",
                  "enum": [
                    "top",
                    "right",
                    "bottom",
                    "left"
                  ]
                },
                "offset": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              }
            },
            "column": {
              "type": "string",
              "description": "Optional column-row anchor for ER entities. Must match the `name` of a column declared in the endpoint entity's `extensions.columns` array. Mismatched names emit an EDGE_COLUMN_NOT_FOUND warning."
            },
            "cardinality": {
              "type": "string",
              "enum": [
                "one",
                "many",
                "zero-or-one",
                "zero-or-many",
                "one-or-many"
              ],
              "description": "ER-style cardinality marker for this endpoint. Omitted, it is inferred from the column the end names. An end that names no column takes its table's only primary key when the other end names a foreign key. Any other end draws no marker. Inferred values aren't stored, so they follow the column."
            }
          },
          "required": [
            "elementId"
          ]
        },
        "to": {
          "type": "object",
          "description": "Edge target (for kind=edge). elementId may reference any element kind - typically a node, but frame and group IDs are also valid targets. An edge to a frame terminates at the frame's border, on the side facing the source, straight across where the source lines up and otherwise at the side's center; useful for abstract group dependencies (e.g. an edge to a 'Regional Services' sidebar rather than to a specific service inside). On entityRelationship diagrams, set `column` to anchor the edge at a specific column row inside the entity. Set `cardinality` for an explicit Crow's Foot glyph; when it is omitted, the engine infers it (see `cardinality`).",
          "properties": {
            "elementId": {
              "type": "string"
            },
            "anchor": {
              "type": "object",
              "description": "Where this end meets its node. side alone fixes the side and leaves the place to the engine. Where the two sides face each other and their faces overlap, the engine lines the ends up so the line is straight; it also spreads ends that share a side and slides a straight line past the title of a frame it enters. offset, 0 to 1 from the side's top (left and right sides) or its left (top and bottom sides), places the end too, with the same corner distance as any end (8 px, more past a rounded corner). It is a fraction of the side as drawn, or of the smaller box a node whose edges dock on one is drawn with. The engine doesn't move it to line it up with another end, so two ends given places that don't line up take a step. An edge with edgeType workflow.sequenceFlow, uiflow.navigate, uiflow.back or uiflow.action enters a node at its center, so a side alone fixes only the face, and its line is straight only where the ends are less than 16 px off center. An anchored edge shares no trunk with other edges. Ignored, with EDGE_ANCHOR_IGNORED, on a sequence message, a self-loop or an end with a column.",
              "additionalProperties": false,
              "required": [
                "side"
              ],
              "properties": {
                "side": {
                  "type": "string",
                  "enum": [
                    "top",
                    "right",
                    "bottom",
                    "left"
                  ]
                },
                "offset": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              }
            },
            "column": {
              "type": "string",
              "description": "Optional column-row anchor for ER entities. Must match the `name` of a column declared in the endpoint entity's `extensions.columns` array. Mismatched names emit an EDGE_COLUMN_NOT_FOUND warning."
            },
            "cardinality": {
              "type": "string",
              "enum": [
                "one",
                "many",
                "zero-or-one",
                "zero-or-many",
                "one-or-many"
              ],
              "description": "ER-style cardinality marker for this endpoint. Omitted, it is inferred from the column the end names. An end that names no column takes its table's only primary key when the other end names a foreign key. Any other end draws no marker. Inferred values aren't stored, so they follow the column."
            }
          },
          "required": [
            "elementId"
          ]
        },
        "router": {
          "type": "string",
          "enum": [
            "straight",
            "orthogonal",
            "curved",
            "polyline"
          ],
          "description": "How the edge is drawn. `orthogonal`, the default when `router` is left off (and `polyline`, drawn the same), is right-angle segments the engine routes round other nodes where a route exists. `straight` is one line between the two nodes' centers, ending where it crosses each node's outline. `curved` is one bowed arc between the two nodes, ending on each outline; a lone curve bows to the side that clears other nodes where one does, and curves between one pair of nodes spread into a lens. Neither `straight` nor `curved` is routed round nodes: one that runs through a node gets the warning EDGE_CROSSES_NODE. Sequence messages ignore `router`."
        },
        "children": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Child element IDs (for kind=group or kind=frame). A spanning frame gives spans instead."
        },
        "spans": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          },
          "description": "Frames: the nodes and frames a spanning frame is drawn round, outside the containment tree (an Auto Scaling group across Availability Zones, a gcp.vpc round its subnets across Regions). Give children or spans, not both. Each target keeps its own frame; no frame lists a spanning frame, its layout is ignored, and it spans no other spanning frame. Drawn in architecture diagrams and diagrams without a family (SPAN_NOT_DRAWN elsewhere). Its box is one rectangle round its targets, so span things that sit together: a node inside it that it doesn't span gets SPAN_COVERS_NODE."
        },
        "step": {
          "type": "integer",
          "minimum": 1,
          "maximum": 99,
          "description": "Edges: a numbered step from 1 to 99, drawn as a badge beside the start of the line, or at the start of a sequence message's arrow, in every family and never for a hidden edge; edges with one number and one source share a badge. The engine draws the numbers given and numbers no other edge, except in a sequence diagram whose document sets extensions.autonumber, which numbers every message and counts on from a message's step. Whole numbers only: write numbering such as 1.1 in the label instead."
        },
        "stepText": {
          "type": "string",
          "description": "Edges: this edge's line in the step list drawn right of the diagram, under its step's badge. Needs step. A step whose edges have no stepText has no entry."
        },
        "emphasis": {
          "type": "boolean",
          "description": "Nodes and edges only: a save that sets it on another kind is refused. true marks the element as part of the one path a reader should follow. An emphasized edge draws its line, arrowheads and label in the theme's emphasis color, an amber, and marks the node at each end. An emphasized node draws its border in that color. The element's own style.stroke and style.strokeWidth are kept instead. A frame at an edge's end isn't marked, and a node that draws no border shows nothing. It moves and resizes no node, except in the Google Cloud case below, and marking a node changes no route. A marked edge shares no trunk, and no point on a node's side, with unmarked edges where the engine can part them, so marking an edge can change its route and theirs. In a Google Cloud diagram, marking some but not all of a global load balancer's lines into two Regions widens the gap between the Regions. The nodes past the gap move, as they do for an edit that needs room. A visual diff draws none. Mark the path, not every edge. The same field as https://zindex.ai/schemas/scene.schema.json describes."
        },
        "title": {
          "type": "string",
          "description": "A frame's title, drawn on it. A group's title isn't drawn: it is written into the SVG as the group's `<title>`. For a visible titled box, use a frame."
        },
        "containerType": {
          "type": "string",
          "enum": [
            "generic",
            "pool",
            "lane",
            "subprocess",
            "partition",
            "package",
            "boundary",
            "fragment",
            "layer",
            "aws.cloud",
            "aws.region",
            "aws.az",
            "aws.vpc",
            "aws.subnet.public",
            "aws.subnet.private",
            "aws.securityGroup",
            "aws.autoScalingGroup",
            "aws.account",
            "aws.corporateDataCenter",
            "gcp.cloud",
            "gcp.project",
            "gcp.region",
            "gcp.vpc",
            "gcp.zone",
            "gcp.subnet",
            "gcp.tier",
            "gcp.instanceGroup",
            "gcp.onPremises"
          ],
          "description": "Frames: what the frame stands for; generic when absent. pool and lane are BPMN's swimlanes, which the engine lays out itself: a pool's children are its lanes (frames with containerType lane), in the order they stack, and a lane's children are its tasks, events and gateways, or lanes of its own. Lanes run along the flow and stack across it, every node a lane lists is placed inside it, each lane is as deep as its contents need, and columns are shared across lanes and pools. Leave layout off pools, lanes and their nodes: a pool's or lane's layout is a minimum, not a fixed box, and a lane's x and y are ignored. fragment is a sequence diagram's combined fragment, laid out with its rows. Any other frame in a sequence diagram is drawn by its children: a participant box round lifelines, or a highlight band behind messages and notes; one that holds both isn't drawn, and boxes don't nest or overlap. The aws.* types are AWS's groups (AWS Architecture Icons): aws.cloud, aws.region, aws.vpc, aws.az, aws.subnet.public, aws.subnet.private, aws.securityGroup, aws.autoScalingGroup, aws.account and aws.corporateDataCenter, each drawn in AWS's color, line and corner icon with no fill and its title in the node label's size, nested as AWS nests them (AWS Cloud, Region, VPC, Availability Zone, subnets); style overrides the preset. In an architecture diagram, or one without a family, aws.cloud, aws.region, aws.vpc, aws.az and the two subnet types also place what they hold as AWS's reference diagrams do (Availability Zones as columns and subnets as rows, or zones as rows with layoutStrategy.direction LR; gateways on the VPC's border facing what they connect to). Leave layout off them and their nodes, a preset's layout being only a minimum, and nest them directly: a generic frame round whole VPCs of a Region, round all of a VPC's Availability Zones, or round subnets next to each other in one zone (a tier), is read through, but any other frame between a Region and its VPC, or a VPC and its Availability Zones, is laid out as any frame with the presets inside it, and one between a zone and its subnets goes after the zone's subnets, everything in it together; a generic one there gets the warning AWS_FRAME_HIDES_GROUPS. A security group or Auto Scaling group across Availability Zones is a spanning frame: give it spans instead of children. The other aws.* types only draw (an aws.account holding Regions is arranged as aws.cloud is). The gcp.* types are Google Cloud's groups, drawn in Google's colors on every canvas, with rounded corners and no icon. gcp.cloud is a blue boundary, gcp.project a light gray panel with its title at the top center (or at the top left where the layout moves it), gcp.region a gray box, gcp.subnet a dashed box, gcp.tier and gcp.instanceGroup white boxes, and gcp.onPremises a beige box. A gcp.cloud with no icon of its own, and no title or the title Google Cloud, draws Google's wordmark in its corner; otherwise its title is drawn in white. Nest them as Google does: gcp.cloud, gcp.project, gcp.region, gcp.subnet, then gcp.tier or gcp.instanceGroup in a subnet or a Region; gcp.onPremises goes outside gcp.cloud. gcp.vpc is a spanning frame: give it spans listing its subnets, and it draws as a dashed box round them, across their Regions. gcp.zone is a spanning frame round the nodes in one zone of a Region: give it spans listing them. It draws as a strip under each node it spans, with its title in it, colored by its order among its Region's zones, and each node it spans is 30 px taller for its strip. gcp.instanceGroup names its kind in its other top corner: Regional MIG when zones put its nodes in two or more zones, Zonal MIG in one. style overrides a gcp.* preset, except on a zone, whose strips ignore it. In an architecture diagram, or one without a family, gcp.cloud, gcp.region and gcp.subnet also arrange what they hold as Google's reference diagrams do: zones as columns, tiers as rows, Regions side by side. Leave layout off them and their nodes; a group's layout is a minimum. Only a tier's cards stand in zone columns, and a frame between the groups, other than a project or a generic frame round whole Regions, loses the arrangement. Draw a GKE cluster, node pool or folder as a generic frame; its cards then stand in no zone column. layer is one row of a stack. In an architecture diagram, or one without a family, the layer frames one frame lists (or, at the root, the layers no frame lists) stack as rows in the order listed, so list them top to bottom: each layer holds its cards and its generic sub-groups (a row wider than 1,400 px wraps into rows), every layer in the stack is as wide as the widest, and each gap holds the lines that pass. layoutStrategy.direction LR, RL or BT turns the stack. Leave layout off a layer and its cards: a layer with a layout of its own keeps that box and is drawn as a generic frame, with no warning. Only the first stack of a scene is arranged. A layer inside a pool, lane or fragment, in a stack after the first, in another family, or in an AWS or Google Cloud diagram anywhere but a generic frame of its own (or a cloud boundary that holds no Region), is placed as a generic frame and gets LAYER_NOT_ARRANGED. The other types draw as a generic frame does; in the dark and sketch themes a generic frame or layer with an opaque fill is a filled panel instead, and the other types keep their border."
        },
        "laneDirection": {
          "type": "string",
          "enum": [
            "vertical",
            "horizontal"
          ],
          "description": "Pools: how the lanes stack. Lanes always run along the flow and stack across it. vertical stacks them top to bottom, which BPMN calls a horizontal pool, and the flow runs left to right (LR, or RL when layoutStrategy.direction asks for it). horizontal puts them side by side, a vertical pool, and the flow runs top to bottom (TB, or BT). When layoutStrategy.direction runs along the lanes' stacking, laneDirection wins and the flow turns. Without laneDirection, lanes stack across the scene's direction: top to bottom in a left-to-right flow (the default outside flowcharts and org charts), side by side in a top-to-bottom one. The first pool in document order with a laneDirection sets the flow for the whole diagram. Lanes along the flow (phases) aren't supported."
        },
        "style": {
          "oneOf": [
            {
              "type": "string",
              "description": "Reference to a named style in scene.styles"
            },
            {
              "type": "object",
              "description": "Inline style overrides (fill, stroke, strokeWidth, dash, fontSize, fontFamily, fontWeight, opacity, textColor or its other name color, labelBackground, cornerRadius, accentColor, forceLabel, multiple). On ER edges, forceLabel: true draws a label that matches an endpoint column, which is otherwise left out; the edge still anchors at that column. On a Google Cloud card, multiple: true draws one gray copy behind it, for several instances of one product; every other node ignores it (https://zindex.ai/docs/reference/rendering/#google-cloud-cards). accentColor draws only the header and PK badges of an er.entity or er.weakEntity with columns, the stripe of an org.person or org.role, the title bar of a uiflow.screen or uiflow.modal, and the border and title of a frame. On a frame, stroke and textColor override it, and it doesn't change the frame's own fill. In the dark and sketch themes, a blue, violet, jade or cyan accent makes a generic frame or a layer with no fill a tier: a tinted panel with no border (https://zindex.ai/docs/reference/rendering/#tints-in-the-dark-theme). Its nodes take the tint unless they set a fill or stroke. A pool, a fragment, an aws.* group, a frame with an aws:* icon and no preset, and a gcp.* group other than a zone keep their own title color, and their borders take the accent. A Google Cloud zone and every other kind of element draw nothing for it. A check, save or edit returns ACCENT_COLOR_NOT_DRAWN: remove it from a zone, color a node with fill and stroke, a line with stroke, text with textColor. Text is drawn in Inter, fontFamily sans, the default. fontFamily mono draws in a monospace font, for paths, endpoints and types. Any other fontFamily draws in Inter with the warning FONT_FAMILY_UNKNOWN: set sans or mono, or remove it. A fallback font draws each character the font lacks.",
              "additionalProperties": true
            }
          ],
          "description": "Element style: either a named-style string key (resolved against scene.styles) or an inline StyleValue object. textColor: when omitted, the rendering engine auto-computes a contrast-appropriate color based on the element's resolved fill (light text on dark fills, dark text on light fills). Edge labels, and labels drawn outside their shape (BPMN events and gateways), are checked against what is under them, and are made lighter or darker when they wouldn't read there, even when textColor is set."
        },
        "icon": {
          "type": "string",
          "description": "A node's icon: a family:id key such as lucide:database or aws:lambda, or an image as a data: URI (a URL stays a link most viewers don't load). A frame's icon is drawn in its header: an AWS key as AWS draws a group icon, in the top-left corner with the title beside it. The same field as https://zindex.ai/schemas/scene.schema.json describes."
        },
        "textStyle": {
          "type": "object",
          "description": "Text layout for a node's label or a text element: wrap (auto, none, word, character), align, verticalAlign. The same fields as https://zindex.ai/schemas/scene.schema.json describes.",
          "additionalProperties": true
        },
        "extensions": {
          "type": "object",
          "description": "Protocol extensions on an element. ER tables (er.entity, er.weakEntity) take extensions.columns, each column as https://zindex.ai/schemas/scene.schema.json#/$defs/erColumn describes: name, and optionally type, pk, fk, unique, nullable, key and comment. A sequence note takes extensions.anchor, the participant ID it sits over or an array it spans. With no anchor it is drawn over the lifelines of the message above it, and FAMILY_SEQ_NOTE_INVALID_ANCHOR warns: set extensions.anchor. A note above every message goes over the first message below it, and one in a diagram with no message goes across every lifeline. extensions.side, left or right, draws the note beside a lifeline instead of over it. With a string anchor, the lifeline is the anchor's. With no anchor, it is the leftmost (left) or rightmost (right) lifeline the note would go over: those of the message above it, else of the first message below it, else every lifeline in the diagram. On an array anchor, side is ignored and FAMILY_SEQ_NOTE_SIDE_IGNORED warns: give one participant ID. A sequence fragment frame takes extensions.operator (alt, opt, loop, par and so on) and extensions.operands, each { startsAt, guard? } as https://zindex.ai/schemas/scene.schema.json#/$defs/fragmentOperand describes: the message or note the operand starts at. A sequence.activation takes extensions.startsAt and extensions.endsAt, the IDs of the messages it runs between.",
          "additionalProperties": true
        }
      },
      "required": [
        "id",
        "kind"
      ]
    },
    "Placement": {
      "type": "object",
      "additionalProperties": false,
      "description": "Where to put the element: exactly one of rightOf, leftOf, above, below or inside, naming another element's ID.",
      "properties": {
        "above": {
          "type": "string"
        },
        "below": {
          "type": "string"
        },
        "leftOf": {
          "type": "string"
        },
        "rightOf": {
          "type": "string"
        },
        "inside": {
          "type": "string",
          "description": "A group, a frame or a container node"
        },
        "gap": {
          "type": "number",
          "minimum": 0,
          "default": 0
        },
        "alignX": {
          "type": "string",
          "enum": [
            "left",
            "center",
            "right"
          ]
        },
        "alignY": {
          "type": "string",
          "enum": [
            "top",
            "center",
            "bottom"
          ]
        }
      },
      "oneOf": [
        {
          "required": [
            "above"
          ]
        },
        {
          "required": [
            "below"
          ]
        },
        {
          "required": [
            "leftOf"
          ]
        },
        {
          "required": [
            "rightOf"
          ]
        },
        {
          "required": [
            "inside"
          ]
        }
      ]
    },
    "RelativeLayout": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mode",
        "place"
      ],
      "properties": {
        "mode": {
          "type": "string",
          "const": "relative"
        },
        "place": {
          "$ref": "#/$defs/Placement"
        },
        "preferredSize": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "width",
            "height"
          ],
          "properties": {
            "width": {
              "type": "number",
              "minimum": 0
            },
            "height": {
              "type": "number",
              "minimum": 0
            }
          }
        },
        "rotation": {
          "type": "number",
          "default": 0,
          "description": "Kept with the layout. The reference engine doesn't rotate anything."
        }
      }
    }
  }
}