Skip to content

Commit

Permalink
add generated output
Browse files Browse the repository at this point in the history
based on obsidianmd#5
  • Loading branch information
Mearman committed Mar 14, 2024
1 parent 27d5d38 commit 9262b5c
Showing 1 changed file with 174 additions and 104 deletions.
278 changes: 174 additions & 104 deletions jsoncanvas.schema.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,31 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"default": {
"edges": [],
"nodes": []
},
"properties": {
"required": true,
"edges": {
"items": {
"$ref": "#/definitions/JSONCanvasEdge"
},
"type": "array"
},
"nodes": {
"items": {
"$ref": "#/definitions/JSONCanvasNode"
},
"type": "array"
}
},
"$ref": "#/definitions/JsonCanvas",
"definitions": {
"JSONCanvasColor": {
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/JSONCanvasColorPreset"
"JsonCanvas": {
"type": "object",
"properties": {
"required": {
"type": "boolean",
"const": true
},
"edges": {
"type": "array",
"items": {
"$ref": "#/definitions/JSONCanvasEdge"
}
},
"nodes": {
"type": "array",
"items": {
"$ref": "#/definitions/JSONCanvasNode"
}
}
]
},
"JSONCanvasColorPreset": {
"enum": [1, 2, 3, 4, 5, 6],
"type": "number"
},
"additionalProperties": {}
},
"JSONCanvasEdge": {
"additionalProperties": false,
"type": "object",
"properties": {
"color": {
"$ref": "#/definitions/JSONCanvasColor"
Expand All @@ -62,38 +52,89 @@
"$ref": "#/definitions/JSONCanvasEdgeSide"
}
},
"required": ["id", "fromNode", "toNode"],
"type": "object"
"required": [
"fromNode",
"id",
"toNode"
],
"additionalProperties": false
},
"JSONCanvasEdgeEnd": {
"enum": ["none", "arrow"],
"type": "string"
"JSONCanvasColor": {
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/JSONCanvasColorPreset"
}
]
},
"JSONCanvasColorPreset": {
"type": "number",
"enum": [
1,
2,
3,
4,
5,
6
]
},
"JSONCanvasEdgeSide": {
"enum": ["top", "right", "bottom", "left"],
"type": "string"
"type": "string",
"enum": [
"top",
"right",
"bottom",
"left"
]
},
"JSONCanvasFileNode": {
"additionalProperties": false,
"JSONCanvasEdgeEnd": {
"type": "string",
"enum": [
"none",
"arrow"
]
},
"JSONCanvasNode": {
"anyOf": [
{
"$ref": "#/definitions/JSONCanvasNodeType"
},
{
"$ref": "#/definitions/JSONCanvasTextNode"
},
{
"$ref": "#/definitions/JSONCanvasFileNode"
},
{
"$ref": "#/definitions/JSONCanvasLinkNode"
},
{
"$ref": "#/definitions/JSONCanvasGroupNode"
}
]
},
"JSONCanvasNodeType": {
"type": "object",
"properties": {
"color": {
"$ref": "#/definitions/JSONCanvasColor"
},
"file": {
"type": "string"
},
"height": {
"type": "number"
},
"id": {
"type": "string"
},
"subpath": {
"type": "string"
},
"type": {
"const": "file",
"type": "string"
"type": "string",
"enum": [
"text",
"file",
"link",
"group"
]
},
"width": {
"type": "number"
Expand All @@ -105,19 +146,19 @@
"type": "number"
}
},
"required": ["file", "height", "id", "type", "width", "x", "y"],
"type": "object"
"required": [
"height",
"id",
"type",
"width",
"x",
"y"
],
"additionalProperties": false
},
"JSONCanvasGroupNode": {
"additionalProperties": false,
"JSONCanvasTextNode": {
"type": "object",
"properties": {
"background": {
"type": "string"
},
"backgroundStyle": {
"enum": ["cover", "ratio", "repeat"],
"type": "string"
},
"color": {
"$ref": "#/definitions/JSONCanvasColor"
},
Expand All @@ -127,12 +168,12 @@
"id": {
"type": "string"
},
"label": {
"text": {
"type": "string"
},
"type": {
"const": "group",
"type": "string"
"type": "string",
"const": "text"
},
"width": {
"type": "number"
Expand All @@ -144,27 +185,38 @@
"type": "number"
}
},
"required": ["height", "id", "type", "width", "x", "y"],
"type": "object"
"required": [
"height",
"id",
"text",
"type",
"width",
"x",
"y"
],
"additionalProperties": false
},
"JSONCanvasLinkNode": {
"additionalProperties": false,
"JSONCanvasFileNode": {
"type": "object",
"properties": {
"color": {
"$ref": "#/definitions/JSONCanvasColor"
},
"file": {
"type": "string"
},
"height": {
"type": "number"
},
"id": {
"type": "string"
},
"type": {
"const": "link",
"subpath": {
"type": "string"
},
"url": {
"type": "string"
"type": {
"type": "string",
"const": "file"
},
"width": {
"type": "number"
Expand All @@ -176,30 +228,19 @@
"type": "number"
}
},
"required": ["height", "id", "type", "url", "width", "x", "y"],
"type": "object"
"required": [
"file",
"height",
"id",
"type",
"width",
"x",
"y"
],
"additionalProperties": false
},
"JSONCanvasNode": {
"anyOf": [
{
"$ref": "#/definitions/JSONCanvasNodeType"
},
{
"$ref": "#/definitions/JSONCanvasTextNode"
},
{
"$ref": "#/definitions/JSONCanvasFileNode"
},
{
"$ref": "#/definitions/JSONCanvasLinkNode"
},
{
"$ref": "#/definitions/JSONCanvasGroupNode"
}
]
},
"JSONCanvasNodeType": {
"additionalProperties": false,
"JSONCanvasLinkNode": {
"type": "object",
"properties": {
"color": {
"$ref": "#/definitions/JSONCanvasColor"
Expand All @@ -211,7 +252,10 @@
"type": "string"
},
"type": {
"enum": ["text", "file", "link", "group"],
"type": "string",
"const": "link"
},
"url": {
"type": "string"
},
"width": {
Expand All @@ -224,12 +268,31 @@
"type": "number"
}
},
"required": ["id", "type", "x", "y", "width", "height"],
"type": "object"
"required": [
"height",
"id",
"type",
"url",
"width",
"x",
"y"
],
"additionalProperties": false
},
"JSONCanvasTextNode": {
"additionalProperties": false,
"JSONCanvasGroupNode": {
"type": "object",
"properties": {
"background": {
"type": "string"
},
"backgroundStyle": {
"type": "string",
"enum": [
"cover",
"ratio",
"repeat"
]
},
"color": {
"$ref": "#/definitions/JSONCanvasColor"
},
Expand All @@ -239,12 +302,12 @@
"id": {
"type": "string"
},
"text": {
"label": {
"type": "string"
},
"type": {
"const": "text",
"type": "string"
"type": "string",
"const": "group"
},
"width": {
"type": "number"
Expand All @@ -256,8 +319,15 @@
"type": "number"
}
},
"required": ["height", "id", "text", "type", "width", "x", "y"],
"type": "object"
"required": [
"height",
"id",
"type",
"width",
"x",
"y"
],
"additionalProperties": false
}
}
}

0 comments on commit 9262b5c

Please sign in to comment.