Skip to content

Commit 5806853

Browse files
committed
Merge remote-tracking branch 'github-desktop-chainlist/jsonschema' into 10-json-schema-C
2 parents a1689eb + bbd03fb commit 5806853

File tree

3 files changed

+278
-83
lines changed

3 files changed

+278
-83
lines changed

Diff for: jsoncanvas.schema.json

+122-74
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,19 @@
55
"JsonCanvas": {
66
"type": "object",
77
"properties": {
8-
"required": {
9-
"type": "boolean",
10-
"const": true
11-
},
128
"edges": {
139
"type": "array",
1410
"items": {
1511
"$ref": "#/definitions/JSONCanvasEdge"
16-
}
12+
},
13+
"description": "Edges are lines that connect one node to another"
1714
},
1815
"nodes": {
1916
"type": "array",
2017
"items": {
2118
"$ref": "#/definitions/JSONCanvasNode"
22-
}
19+
},
20+
"description": "Nodes are objects within the canvas. Nodes may be text, files, links, or groups"
2321
}
2422
},
2523
"additionalProperties": {}
@@ -31,25 +29,43 @@
3129
"$ref": "#/definitions/JSONCanvasColor"
3230
},
3331
"fromNode": {
34-
"type": "string"
32+
"type": "string",
33+
"description": "The ID of the node that the edge starts from"
3534
},
3635
"fromSide": {
37-
"$ref": "#/definitions/JSONCanvasEdgeSide"
36+
"type": "string",
37+
"enum": [
38+
"top",
39+
"right",
40+
"bottom",
41+
"left"
42+
],
43+
"description": "The side of the node that the edge connects from"
3844
},
3945
"id": {
40-
"type": "string"
46+
"type": "string",
47+
"description": "The ID for the edge"
4148
},
4249
"label": {
43-
"type": "string"
50+
"type": "string",
51+
"description": "The text label for the edge"
4452
},
4553
"toEnd": {
4654
"$ref": "#/definitions/JSONCanvasEdgeEnd"
4755
},
4856
"toNode": {
49-
"type": "string"
57+
"type": "string",
58+
"description": "The ID of the node that the edge ends at"
5059
},
5160
"toSide": {
52-
"$ref": "#/definitions/JSONCanvasEdgeSide"
61+
"type": "string",
62+
"enum": [
63+
"top",
64+
"right",
65+
"bottom",
66+
"left"
67+
],
68+
"description": "The side of the node that the edge connects to"
5369
}
5470
},
5571
"required": [
@@ -65,41 +81,34 @@
6581
"type": "string"
6682
},
6783
{
68-
"$ref": "#/definitions/JSONCanvasColorPreset"
84+
"$ref": "#/definitions/APresetColor"
6985
}
7086
]
7187
},
72-
"JSONCanvasColorPreset": {
73-
"type": "number",
74-
"enum": [
75-
1,
76-
2,
77-
3,
78-
4,
79-
5,
80-
6
81-
]
82-
},
83-
"JSONCanvasEdgeSide": {
88+
"APresetColor": {
8489
"type": "string",
8590
"enum": [
86-
"top",
87-
"right",
88-
"bottom",
89-
"left"
90-
]
91+
"1",
92+
"2",
93+
"3",
94+
"4",
95+
"5",
96+
"6"
97+
],
98+
"description": "Six preset colors exist, mapped to the following numbers: 1 red 2 orange 3 yellow 4 green 5 cyan 6 purple"
9199
},
92100
"JSONCanvasEdgeEnd": {
93101
"type": "string",
94102
"enum": [
95103
"none",
96104
"arrow"
97-
]
105+
],
106+
"description": "The rendering style of the end of the edge line"
98107
},
99108
"JSONCanvasNode": {
100109
"anyOf": [
101110
{
102-
"$ref": "#/definitions/JSONCanvasNodeType"
111+
"$ref": "#/definitions/JSONCanvasNodeGeneric"
103112
},
104113
{
105114
"$ref": "#/definitions/JSONCanvasTextNode"
@@ -115,17 +124,19 @@
115124
}
116125
]
117126
},
118-
"JSONCanvasNodeType": {
127+
"JSONCanvasNodeGeneric": {
119128
"type": "object",
120129
"properties": {
121130
"color": {
122131
"$ref": "#/definitions/JSONCanvasColor"
123132
},
124133
"height": {
125-
"type": "number"
134+
"type": "number",
135+
"description": "The height of the node in pixels"
126136
},
127137
"id": {
128-
"type": "string"
138+
"type": "string",
139+
"description": "Unique ID for the node"
129140
},
130141
"type": {
131142
"type": "string",
@@ -134,16 +145,20 @@
134145
"file",
135146
"link",
136147
"group"
137-
]
148+
],
149+
"description": "The node type"
138150
},
139151
"width": {
140-
"type": "number"
152+
"type": "number",
153+
"description": "The width of the node in pixels"
141154
},
142155
"x": {
143-
"type": "number"
156+
"type": "number",
157+
"description": "The x position of the node in pixels"
144158
},
145159
"y": {
146-
"type": "number"
160+
"type": "number",
161+
"description": "The y position of the node in pixels"
147162
}
148163
},
149164
"required": [
@@ -163,26 +178,33 @@
163178
"$ref": "#/definitions/JSONCanvasColor"
164179
},
165180
"height": {
166-
"type": "number"
181+
"type": "number",
182+
"description": "The height of the node in pixels"
167183
},
168184
"id": {
169-
"type": "string"
185+
"type": "string",
186+
"description": "Unique ID for the node"
170187
},
171188
"text": {
172-
"type": "string"
189+
"type": "string",
190+
"description": "Plain text with Markdown syntax"
173191
},
174192
"type": {
175193
"type": "string",
176-
"const": "text"
194+
"const": "text",
195+
"description": "The node type"
177196
},
178197
"width": {
179-
"type": "number"
198+
"type": "number",
199+
"description": "The width of the node in pixels"
180200
},
181201
"x": {
182-
"type": "number"
202+
"type": "number",
203+
"description": "The x position of the node in pixels"
183204
},
184205
"y": {
185-
"type": "number"
206+
"type": "number",
207+
"description": "The y position of the node in pixels"
186208
}
187209
},
188210
"required": [
@@ -203,29 +225,37 @@
203225
"$ref": "#/definitions/JSONCanvasColor"
204226
},
205227
"file": {
206-
"type": "string"
228+
"type": "string",
229+
"description": "The path to the file within the system"
207230
},
208231
"height": {
209-
"type": "number"
232+
"type": "number",
233+
"description": "The height of the node in pixels"
210234
},
211235
"id": {
212-
"type": "string"
236+
"type": "string",
237+
"description": "Unique ID for the node"
213238
},
214239
"subpath": {
215-
"type": "string"
240+
"type": "string",
241+
"description": "The subpath that may link to a heading or a block. Always starts with a #"
216242
},
217243
"type": {
218244
"type": "string",
219-
"const": "file"
245+
"const": "file",
246+
"description": "The node type"
220247
},
221248
"width": {
222-
"type": "number"
249+
"type": "number",
250+
"description": "The width of the node in pixels"
223251
},
224252
"x": {
225-
"type": "number"
253+
"type": "number",
254+
"description": "The x position of the node in pixels"
226255
},
227256
"y": {
228-
"type": "number"
257+
"type": "number",
258+
"description": "The y position of the node in pixels"
229259
}
230260
},
231261
"required": [
@@ -246,26 +276,32 @@
246276
"$ref": "#/definitions/JSONCanvasColor"
247277
},
248278
"height": {
249-
"type": "number"
279+
"type": "number",
280+
"description": "The height of the node in pixels"
250281
},
251282
"id": {
252-
"type": "string"
283+
"type": "string",
284+
"description": "Unique ID for the node"
253285
},
254286
"type": {
255287
"type": "string",
256-
"const": "link"
288+
"const": "link",
289+
"description": "The node type"
257290
},
258291
"url": {
259292
"type": "string"
260293
},
261294
"width": {
262-
"type": "number"
295+
"type": "number",
296+
"description": "The width of the node in pixels"
263297
},
264298
"x": {
265-
"type": "number"
299+
"type": "number",
300+
"description": "The x position of the node in pixels"
266301
},
267302
"y": {
268-
"type": "number"
303+
"type": "number",
304+
"description": "The y position of the node in pixels"
269305
}
270306
},
271307
"required": [
@@ -283,40 +319,43 @@
283319
"type": "object",
284320
"properties": {
285321
"background": {
286-
"type": "string"
322+
"type": "string",
323+
"description": "The path to the background image"
287324
},
288325
"backgroundStyle": {
289-
"type": "string",
290-
"enum": [
291-
"cover",
292-
"ratio",
293-
"repeat"
294-
]
326+
"$ref": "#/definitions/TheRenderingStyleOfABackgroundImage"
295327
},
296328
"color": {
297329
"$ref": "#/definitions/JSONCanvasColor"
298330
},
299331
"height": {
300-
"type": "number"
332+
"type": "number",
333+
"description": "The height of the node in pixels"
301334
},
302335
"id": {
303-
"type": "string"
336+
"type": "string",
337+
"description": "Unique ID for the node"
304338
},
305339
"label": {
306-
"type": "string"
340+
"type": "string",
341+
"description": "The text label for the group"
307342
},
308343
"type": {
309344
"type": "string",
310-
"const": "group"
345+
"const": "group",
346+
"description": "The node type"
311347
},
312348
"width": {
313-
"type": "number"
349+
"type": "number",
350+
"description": "The width of the node in pixels"
314351
},
315352
"x": {
316-
"type": "number"
353+
"type": "number",
354+
"description": "The x position of the node in pixels"
317355
},
318356
"y": {
319-
"type": "number"
357+
"type": "number",
358+
"description": "The y position of the node in pixels"
320359
}
321360
},
322361
"required": [
@@ -328,6 +367,15 @@
328367
"y"
329368
],
330369
"additionalProperties": false
370+
},
371+
"TheRenderingStyleOfABackgroundImage": {
372+
"type": "string",
373+
"enum": [
374+
"cover",
375+
"ratio",
376+
"repeat"
377+
],
378+
"description": "Options are: cover - fills the entire width and height of the node. ratio - maintains the aspect ratio of the background image. repeat - repeats the image as a pattern in both x/y directions."
331379
}
332380
}
333381
}

Diff for: sample.canvas

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "./jsoncanvas.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},

0 commit comments

Comments
 (0)