Skip to content

Commit b80ea58

Browse files
author
kguillouard
committed
added description, change version
1 parent f493d4b commit b80ea58

File tree

2 files changed

+66
-13
lines changed

2 files changed

+66
-13
lines changed

sample.canvas

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "./schema.json",
23
"nodes":[
34
{"id":"8132d4d894c80022","type":"file","file":"readme.md","x":-280,"y":-200,"width":570,"height":560,"color":"6"},
45
{"id":"7efdbbe0c4742315","type":"file","file":"_site/logo.svg","x":-280,"y":-440,"width":217,"height":80},

schema.json

+65-13
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,38 @@
66
},
77
"properties": {
88
"edges": {
9+
"description": "Edges are lines that connect one node to another",
910
"items": {
1011
"$ref": "#/definitions/JSONCanvasEdge"
1112
},
1213
"type": "array"
1314
},
1415
"nodes": {
16+
"description": "Nodes are objects within the canvas. Nodes may be text, files, links, or groups",
1517
"items": {
1618
"$ref": "#/definitions/JSONCanvasNode"
1719
},
1820
"type": "array"
1921
}
2022
},
21-
"definitions": {
23+
"$defs": {
2224
"JSONCanvasColor": {
2325
"anyOf": [
2426
{
25-
"type": "string"
27+
"description": "A color in hex format, e.g. #ff0000",
28+
"type": "string",
29+
"pattern": "^#[0-9a-fA-F]{6}$"
2630
},
2731
{
2832
"$ref": "#/definitions/JSONCanvasColorPreset"
2933
}
3034
]
3135
},
3236
"JSONCanvasColorPreset": {
33-
"enum": [1, 2, 3, 4, 5, 6],
34-
"type": "number"
37+
"title": "A preset color.",
38+
"description": "Six preset colors exist, mapped to the following numbers:\n1 red\n2 orange\n3 yellow\n4 green\n5 cyan\n6 purple",
39+
"enum": ["1", "2", "3", "4", "5", "6"],
40+
"type": "string"
3541
},
3642
"JSONCanvasEdge": {
3743
"additionalProperties": false,
@@ -40,35 +46,43 @@
4046
"$ref": "#/definitions/JSONCanvasColor"
4147
},
4248
"fromNode": {
49+
"description": "The ID of the node that the edge starts from",
4350
"type": "string"
4451
},
4552
"fromSide": {
53+
"description": "The side of the node that the edge connects from",
4654
"$ref": "#/definitions/JSONCanvasEdgeSide"
4755
},
4856
"id": {
57+
"description": "The ID for the edge",
4958
"type": "string"
5059
},
5160
"label": {
61+
"description": "The text label for the edge",
5262
"type": "string"
5363
},
5464
"toEnd": {
5565
"$ref": "#/definitions/JSONCanvasEdgeEnd"
5666
},
5767
"toNode": {
68+
"description": "The ID of the node that the edge ends at",
5869
"type": "string"
5970
},
6071
"toSide": {
72+
"description": "The side of the node that the edge connects to",
6173
"$ref": "#/definitions/JSONCanvasEdgeSide"
6274
}
6375
},
6476
"required": ["id", "fromNode", "toNode"],
6577
"type": "object"
6678
},
6779
"JSONCanvasEdgeEnd": {
80+
"description": "The rendering style of the end of the edge line",
6881
"enum": ["none", "arrow"],
6982
"type": "string"
7083
},
7184
"JSONCanvasEdgeSide": {
85+
"description": "The side of the node that the edge connects to",
7286
"enum": ["top", "right", "bottom", "left"],
7387
"type": "string"
7488
},
@@ -79,28 +93,37 @@
7993
"$ref": "#/definitions/JSONCanvasColor"
8094
},
8195
"file": {
82-
"type": "string"
96+
"description": "The path to the file within the system",
97+
"type": "string",
98+
"minLength": 1
8399
},
84100
"height": {
101+
"description": "The height of the node in pixels",
85102
"type": "number"
86103
},
87104
"id": {
105+
"description": "Unique ID for the node",
88106
"type": "string"
89107
},
90108
"subpath": {
109+
"description": "The subpath that may link to a heading or a block. Always starts with a #",
91110
"type": "string"
92111
},
93112
"type": {
113+
"description": "The node type",
94114
"const": "file",
95115
"type": "string"
96116
},
97117
"width": {
118+
"description": "The width of the node in pixels",
98119
"type": "number"
99120
},
100121
"x": {
122+
"description": "The x position of the node in pixels",
101123
"type": "number"
102124
},
103125
"y": {
126+
"description": "The y position of the node in pixels",
104127
"type": "number"
105128
}
106129
},
@@ -111,35 +134,45 @@
111134
"additionalProperties": false,
112135
"properties": {
113136
"background": {
137+
"description": "The path to the background image",
114138
"type": "string"
115139
},
116140
"backgroundStyle": {
141+
"title": "The rendering style of a background image.",
142+
"description": "Options are:\ncover - fills the entire width and height of the node.\nratio - maintains the aspect ratio of the background image.\nrepeat - repeats the image as a pattern in both x/y directions.",
117143
"enum": ["cover", "ratio", "repeat"],
118144
"type": "string"
119145
},
120146
"color": {
121147
"$ref": "#/definitions/JSONCanvasColor"
122148
},
123149
"height": {
150+
"description": "The height of the node in pixels",
124151
"type": "number"
125152
},
126153
"id": {
154+
"description": "Unique ID for the node",
127155
"type": "string"
128156
},
129157
"label": {
158+
"description": "The text label for the group",
130159
"type": "string"
131160
},
132161
"type": {
162+
"description": "The node type",
133163
"const": "group",
134164
"type": "string"
135165
},
136166
"width": {
167+
"description": "The width of the node in pixels",
137168
"type": "number"
138169
},
139170
"x": {
171+
"description": "The x position of the node in pixels",
140172
"type": "number"
141173
},
142174
"y": {
175+
"description": "The y position of the node in pixels",
143176
"type": "number"
144177
}
145178
},
@@ -153,25 +186,31 @@
153186
"$ref": "#/definitions/JSONCanvasColor"
154187
},
155188
"height": {
189+
"description": "The height of the node in pixels",
156190
"type": "number"
157191
},
158192
"id": {
193+
"description": "Unique ID for the node",
159194
"type": "string"
160195
},
161196
"type": {
197+
"description": "The node type",
162198
"const": "link",
163199
"type": "string"
164200
},
165201
"url": {
166202
"type": "string"
167203
},
168204
"width": {
169-
"type": "integer"
205+
"description": "The width of the node in pixels",
206+
"type": "number"
170207
},
171208
"x": {
172-
"type": "integer"
209+
"description": "The x position of the node in pixels",
210+
"type": "number"
173211
},
174212
"y": {
213+
"description": "The y position of the node in pixels",
175214
"type": "number"
176215
}
177216
},
@@ -181,7 +220,7 @@
181220
"JSONCanvasNode": {
182221
"anyOf": [
183222
{
184-
"$ref": "#/definitions/JSONCanvasNodeType"
223+
"$ref": "#/definitions/JSONCanvasNodeGeneric"
185224
},
186225
{
187226
"$ref": "#/definitions/JSONCanvasTextNode"
@@ -197,29 +236,35 @@
197236
}
198237
]
199238
},
200-
"JSONCanvasNodeType": {
239+
"JSONCanvasNodeGeneric": {
201240
"additionalProperties": false,
202241
"properties": {
203242
"color": {
204243
"$ref": "#/definitions/JSONCanvasColor"
205244
},
206245
"height": {
246+
"description": "The height of the node in pixels",
207247
"type": "number"
208248
},
209249
"id": {
250+
"description": "Unique ID for the node",
210251
"type": "string"
211252
},
212253
"type": {
254+
"description": "The node type",
213255
"enum": ["text", "file", "link", "group"],
214256
"type": "string"
215257
},
216258
"width": {
259+
"description": "The width of the node in pixels",
217260
"type": "number"
218261
},
219262
"x": {
263+
"description": "The x position of the node in pixels",
220264
"type": "number"
221265
},
222266
"y": {
267+
"description": "The y position of the node in pixels",
223268
"type": "number"
224269
}
225270
},
@@ -233,26 +278,33 @@
233278
"$ref": "#/definitions/JSONCanvasColor"
234279
},
235280
"height": {
236-
"type": "integer"
281+
"description": "The height of the node in pixels",
282+
"type": "number"
237283
},
238284
"id": {
285+
"description": "Unique ID for the node",
239286
"type": "string"
240287
},
241288
"text": {
289+
"description": "Plain text with Markdown syntax",
242290
"type": "string"
243291
},
244292
"type": {
293+
"description": "The node type",
245294
"const": "text",
246295
"type": "string"
247296
},
248297
"width": {
249-
"type": "integer"
298+
"description": "The width of the node in pixels",
299+
"type": "number"
250300
},
251301
"x": {
252-
"type": "integer"
302+
"description": "The x position of the node in pixels",
303+
"type": "number"
253304
},
254305
"y": {
255-
"type": "integer"
306+
"description": "The y position of the node in pixels",
307+
"type": "number"
256308
}
257309
},
258310
"required": ["height", "id", "text", "type", "width", "x", "y"],

0 commit comments

Comments
 (0)