Skip to content

自定义格式

使用自定义格式(.custom)构建架构图、系统设计和流程,完全控制节点和边。 该格式基于JSON,并保存为文件。.custom

简视图编辑器画布展示

JSON Schema

想了解该格式的完整规范?您可以在此查看 JSON Schema 定义:

查看完整 Schema{target="_blank"}

使用示例

json
{
  "direction": "LEFT",
  "nodes": [
    {
      "id": "order",
      "label": "订单表",
      "iconUrl": "ep:document",
      "fields": {
        "主键": "order_id (BIGINT)",
        "外键": "user_id (关联用户表)",
        "核心字段": "order_no/amount/status",
        "索引": "idx_user_id, idx_order_no"
      }
    },
    {
      "id": "product",
      "label": "商品表",
      "iconUrl": "ep:box",
      "fields": {
        "主键": "product_id (BIGINT)",
        "核心字段": "name/price/stock/category_id",
        "索引": "idx_category_id, idx_name",
        "数据量": "10万+"
      }
    },
    {
      "id": "order_item",
      "label": "订单明细表",
      "iconUrl": "ep:tickets",
      "fields": {
        "主键": "item_id (BIGINT)",
        "外键": "order_id, product_id",
        "核心字段": "quantity/unit_price",
        "关系": "一对多(订单->明细)"
      }
    }
  ],
  "edges": [
    {
      "from": "order",
      "to": "order_item",
      "label": "1:N 包含"
    },
    {
      "from": "product",
      "to": "order_item",
      "label": "1:N 被订购"
    }
  ]
}

图标

您可以使用 Iconify 上提供的 200,000+ 图标中的任意一个用来渲染 iconUrl 字段,例如 ep:documentep:box。请使用有效的 Iconify 图标名称;无效的名称将不会渲染。

json
{
  "id": "server",
  "label": "web",
  "iconUrl": "ep:document"
}

结构

属性类型
directionRIGHT | DOWN | LEFT | UP
nodesNode[]
edges?Edge[]
[key: string]string | number | boolean | null | object | array

节点

每个节点必须包含 id 字段。使用 fields 对象添加键值对,这些键值对将作为行显示在节点卡片上。

属性类型
idstring
label?string
imageUrl?string
iconUrl?string
nodes?Node[]
fields?Record<string, string | number | boolean | null>
[key: string]string | number | boolean | null | object | array

Fields 示例

json
{
  "id": "order",
  "label": "订单表",
  "iconUrl": "ep:document",
  "fields": {
    "primaryKey": "order_id (BIGINT)",
    "foreignKey": "user_id (references user table)",
    "coreFields": "order_no/amount/status",
    "indexes": "idx_user_id, idx_order_no"
  }
}

边定义节点之间的连接关系。

属性类型
fromstring
tostring
label?string
json
{
  "edges": [
    {
      "from": "node1",
      "to": "node2",
      "label": "调用"
    }
  ]
}

版权所有 © 2026-至今 简视图