{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "mode": {
      "type": "string",
      "enum": [
        "directed",
        "undirected",
        "bidirectional"
      ]
    },
    "initialNodeId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "nodes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "node"
          },
          "id": {
            "type": "string"
          },
          "parentId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "initialNodeId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "data": {},
          "x": {
            "type": "number"
          },
          "y": {
            "type": "number"
          },
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          },
          "shape": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "style": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "ports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "direction": {
                  "type": "string",
                  "enum": [
                    "in",
                    "out",
                    "inout"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "data": {},
                "x": {
                  "type": "number"
                },
                "y": {
                  "type": "number"
                },
                "width": {
                  "type": "number"
                },
                "height": {
                  "type": "number"
                },
                "style": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "boolean"
                      }
                    ]
                  }
                }
              },
              "required": [
                "name",
                "direction",
                "data"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "type",
          "id",
          "data"
        ],
        "additionalProperties": false
      }
    },
    "edges": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "edge"
          },
          "id": {
            "type": "string"
          },
          "sourceId": {
            "type": "string"
          },
          "targetId": {
            "type": "string"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "weight": {
            "type": "number"
          },
          "sourcePort": {
            "type": "string"
          },
          "targetPort": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "directed",
              "undirected",
              "bidirectional"
            ]
          },
          "points": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "x": {
                  "type": "number"
                },
                "y": {
                  "type": "number"
                }
              },
              "required": [
                "x",
                "y"
              ],
              "additionalProperties": false
            }
          },
          "routing": {
            "type": "string",
            "enum": [
              "polyline",
              "orthogonal",
              "splines"
            ]
          },
          "data": {},
          "x": {
            "type": "number"
          },
          "y": {
            "type": "number"
          },
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          },
          "color": {
            "type": "string"
          },
          "style": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          }
        },
        "required": [
          "type",
          "id",
          "sourceId",
          "targetId",
          "data"
        ],
        "additionalProperties": false
      }
    },
    "data": {},
    "direction": {
      "type": "string",
      "enum": [
        "up",
        "down",
        "left",
        "right"
      ]
    },
    "style": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          }
        ]
      }
    }
  },
  "required": [
    "id",
    "mode",
    "nodes",
    "edges",
    "data"
  ],
  "additionalProperties": false
}
