← Files Mermaid DiagramsARCHIVED FILE

skills/mermaid-diagrams/references/canonical-v2.schema.json

10.7 KB · Oct 5, 2026 · 18:31 UTC

↓ Download file

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/theisegoria/chatgpt-skill-plugins/schemas/mermaid-diagrams/canonical-v2.schema.json",
  "title": "Mermaid Diagrams canonical document v2",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "title", "diagrams"],
  "properties": {
    "version": {"const": 2},
    "title": {"$ref": "#/$defs/text"},
    "description": {"$ref": "#/$defs/optionalText"},
    "diagrams": {
      "type": "array",
      "minItems": 1,
      "maxItems": 64,
      "items": {"$ref": "#/$defs/diagram"}
    }
  },
  "$defs": {
    "text": {"type": "string", "minLength": 1, "maxLength": 65536},
    "optionalText": {"oneOf": [{"$ref": "#/$defs/text"}, {"type": "null"}]},
    "id": {"type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_-]*$", "maxLength": 256},
    "style": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "definition"],
      "properties": {
        "name": {"$ref": "#/$defs/id"},
        "definition": {"type": "string", "minLength": 1, "maxLength": 4096}
      }
    },
    "diagram": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "title", "kind"],
      "properties": {
        "id": {"$ref": "#/$defs/id"},
        "title": {"$ref": "#/$defs/text"},
        "description": {"$ref": "#/$defs/optionalText"},
        "accessibility": {"$ref": "#/$defs/optionalText"},
        "kind": {"enum": ["flowchart", "sequence", "state", "class", "er", "mindmap", "architecture", "gantt", "timeline", "kanban", "raw"]},
        "data": {"type": "object"},
        "source": {"type": "string", "minLength": 1, "maxLength": 2097152},
        "styles": {"type": "array", "maxItems": 256, "items": {"$ref": "#/$defs/style"}}
      },
      "allOf": [
        {
          "if": {"properties": {"kind": {"const": "raw"}}, "required": ["kind"]},
          "then": {"required": ["source"], "not": {"required": ["data"]}},
          "else": {"required": ["data"], "not": {"required": ["source"]}}
        },
        {"if": {"properties": {"kind": {"const": "flowchart"}}}, "then": {"properties": {"data": {"$ref": "#/$defs/flowchart"}}}},
        {"if": {"properties": {"kind": {"const": "sequence"}}}, "then": {"properties": {"data": {"$ref": "#/$defs/sequence"}}}},
        {"if": {"properties": {"kind": {"const": "state"}}}, "then": {"properties": {"data": {"$ref": "#/$defs/state"}}}},
        {"if": {"properties": {"kind": {"const": "class"}}}, "then": {"properties": {"data": {"$ref": "#/$defs/class"}}}},
        {"if": {"properties": {"kind": {"const": "er"}}}, "then": {"properties": {"data": {"$ref": "#/$defs/er"}}}},
        {"if": {"properties": {"kind": {"const": "mindmap"}}}, "then": {"properties": {"data": {"$ref": "#/$defs/mindmap"}}}},
        {"if": {"properties": {"kind": {"const": "architecture"}}}, "then": {"properties": {"data": {"$ref": "#/$defs/architecture"}}}},
        {"if": {"properties": {"kind": {"const": "gantt"}}}, "then": {"properties": {"data": {"$ref": "#/$defs/gantt"}}}},
        {"if": {"properties": {"kind": {"const": "timeline"}}}, "then": {"properties": {"data": {"$ref": "#/$defs/timeline"}}}},
        {"if": {"properties": {"kind": {"const": "kanban"}}}, "then": {"properties": {"data": {"$ref": "#/$defs/kanban"}}}},
        {"if": {"properties": {"kind": {"not": {"const": "flowchart"}}}, "required": ["kind"]}, "then": {"properties": {"styles": {"maxItems": 0}}}}
      ]
    },
    "flowchart": {
      "type": "object", "additionalProperties": false, "required": ["nodes", "edges"],
      "properties": {
        "direction": {"enum": ["LR", "RL", "TB", "BT"]},
        "nodes": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["id", "label"], "properties": {"id": {"$ref": "#/$defs/id"}, "label": {"$ref": "#/$defs/text"}, "class": {"oneOf": [{"$ref": "#/$defs/id"}, {"type": "null"}]}}}},
        "edges": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["from", "to"], "properties": {"from": {"$ref": "#/$defs/id"}, "to": {"$ref": "#/$defs/id"}, "label": {"$ref": "#/$defs/optionalText"}, "arrow": {"enum": ["-->", "---", "-.->", "==>"]}}}}
      }
    },
    "sequence": {
      "type": "object", "additionalProperties": false, "required": ["participants", "messages"],
      "properties": {
        "participants": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["id", "label"], "properties": {"id": {"$ref": "#/$defs/id"}, "label": {"$ref": "#/$defs/text"}, "actor": {"type": "boolean"}}}},
        "messages": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["from", "to", "text"], "properties": {"from": {"$ref": "#/$defs/id"}, "to": {"$ref": "#/$defs/id"}, "text": {"$ref": "#/$defs/text"}, "kind": {"enum": ["sync", "async", "reply"]}}}}
      }
    },
    "state": {
      "type": "object", "additionalProperties": false, "required": ["states", "transitions", "initial"],
      "properties": {
        "states": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["id", "label"], "properties": {"id": {"$ref": "#/$defs/id"}, "label": {"$ref": "#/$defs/text"}}}},
        "transitions": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["from", "to"], "properties": {"from": {"$ref": "#/$defs/id"}, "to": {"$ref": "#/$defs/id"}, "label": {"$ref": "#/$defs/optionalText"}}}},
        "initial": {"$ref": "#/$defs/id"}
      }
    },
    "class": {
      "type": "object", "additionalProperties": false, "required": ["classes", "relations"],
      "properties": {
        "classes": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["id"], "properties": {"id": {"$ref": "#/$defs/id"}, "members": {"type": "array", "maxItems": 4000, "items": {"$ref": "#/$defs/text"}}}}},
        "relations": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["from", "to"], "properties": {"from": {"$ref": "#/$defs/id"}, "to": {"$ref": "#/$defs/id"}, "kind": {"enum": ["inheritance", "composition", "aggregation", "association"]}, "label": {"$ref": "#/$defs/optionalText"}}}}
      }
    },
    "er": {
      "type": "object", "additionalProperties": false, "required": ["entities", "relationships"],
      "properties": {
        "entities": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["id"], "properties": {"id": {"$ref": "#/$defs/id"}, "attributes": {"type": "array", "maxItems": 4000, "items": {"$ref": "#/$defs/text"}}}}},
        "relationships": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["from", "to", "cardinality", "label"], "properties": {"from": {"$ref": "#/$defs/id"}, "to": {"$ref": "#/$defs/id"}, "cardinality": {"type": "string", "minLength": 5, "maxLength": 32}, "label": {"$ref": "#/$defs/text"}}}}
      }
    },
    "mindmapNode": {
      "type": "object", "additionalProperties": false, "required": ["text"],
      "properties": {"text": {"$ref": "#/$defs/text"}, "children": {"type": "array", "maxItems": 4000, "items": {"$ref": "#/$defs/mindmapNode"}}}
    },
    "mindmap": {"type": "object", "additionalProperties": false, "required": ["root"], "properties": {"root": {"$ref": "#/$defs/mindmapNode"}}},
    "architecture": {
      "type": "object", "additionalProperties": false, "required": ["services"],
      "properties": {
        "groups": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["id", "label"], "properties": {"id": {"$ref": "#/$defs/id"}, "label": {"$ref": "#/$defs/text"}, "icon": {"enum": ["cloud", "database", "disk", "internet", "server"]}, "parent": {"oneOf": [{"$ref": "#/$defs/id"}, {"type": "null"}]}}}},
        "services": {"type": "array", "minItems": 1, "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["id", "label"], "properties": {"id": {"$ref": "#/$defs/id"}, "label": {"$ref": "#/$defs/text"}, "icon": {"enum": ["cloud", "database", "disk", "internet", "server"]}, "group": {"oneOf": [{"$ref": "#/$defs/id"}, {"type": "null"}]}}}},
        "edges": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["from", "to"], "properties": {"from": {"$ref": "#/$defs/id"}, "to": {"$ref": "#/$defs/id"}, "label": {"$ref": "#/$defs/optionalText"}, "fromSide": {"enum": ["L", "R", "T", "B"]}, "toSide": {"enum": ["L", "R", "T", "B"]}}}}
      }
    },
    "gantt": {
      "type": "object", "additionalProperties": false, "required": ["sections"],
      "properties": {
        "dateFormat": {"type": "string", "minLength": 1, "maxLength": 64},
        "axisFormat": {"type": "string", "minLength": 1, "maxLength": 64},
        "sections": {"type": "array", "minItems": 1, "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["title", "tasks"], "properties": {"title": {"$ref": "#/$defs/text"}, "tasks": {"type": "array", "minItems": 1, "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["id", "label", "start", "end"], "properties": {"id": {"$ref": "#/$defs/id"}, "label": {"$ref": "#/$defs/text"}, "start": {"type": "string", "minLength": 1, "maxLength": 64}, "end": {"type": "string", "minLength": 1, "maxLength": 64}, "status": {"oneOf": [{"enum": ["done", "active", "crit", "milestone"]}, {"type": "null"}]}}}}}}}
      }
    },
    "timeline": {
      "type": "object", "additionalProperties": false, "required": ["sections"],
      "properties": {"sections": {"type": "array", "minItems": 1, "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["title", "events"], "properties": {"title": {"$ref": "#/$defs/text"}, "events": {"type": "array", "minItems": 1, "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["time", "text"], "properties": {"time": {"$ref": "#/$defs/text"}, "text": {"$ref": "#/$defs/text"}}}}}}}}
    },
    "kanban": {
      "type": "object", "additionalProperties": false, "required": ["columns"],
      "properties": {"columns": {"type": "array", "minItems": 1, "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["id", "label", "items"], "properties": {"id": {"$ref": "#/$defs/id"}, "label": {"$ref": "#/$defs/text"}, "items": {"type": "array", "maxItems": 4000, "items": {"type": "object", "additionalProperties": false, "required": ["id", "label"], "properties": {"id": {"$ref": "#/$defs/id"}, "label": {"$ref": "#/$defs/text"}}}}}}}}
    }
  }
}

SHA-256: d204e9c349edcefa5c0d3e6105304026d329e0eb04e6abebc11a49d7ad941a0e