Skip to content

Commit 9262b5c

Browse files
committed
add generated output
based on #5
1 parent 27d5d38 commit 9262b5c

File tree

1 file changed

+174
-104
lines changed

1 file changed

+174
-104
lines changed

jsoncanvas.schema.json

Lines changed: 174 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,31 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"default": {
4-
"edges": [],
5-
"nodes": []
6-
},
7-
"properties": {
8-
"required": true,
9-
"edges": {
10-
"items": {
11-
"$ref": "#/definitions/JSONCanvasEdge"
12-
},
13-
"type": "array"
14-
},
15-
"nodes": {
16-
"items": {
17-
"$ref": "#/definitions/JSONCanvasNode"
18-
},
19-
"type": "array"
20-
}
21-
},
3+
"$ref": "#/definitions/JsonCanvas",
224
"definitions": {
23-
"JSONCanvasColor": {
24-
"anyOf": [
25-
{
26-
"type": "string"
27-
},
28-
{
29-
"$ref": "#/definitions/JSONCanvasColorPreset"
5+
"JsonCanvas": {
6+
"type": "object",
7+
"properties": {
8+
"required": {
9+
"type": "boolean",
10+
"const": true
11+
},
12+
"edges": {
13+
"type": "array",
14+
"items": {
15+
"$ref": "#/definitions/JSONCanvasEdge"
16+
}
17+
},
18+
"nodes": {
19+
"type": "array",
20+
"items": {
21+
"$ref": "#/definitions/JSONCanvasNode"
22+
}
3023
}
31-
]
32-
},
33-
"JSONCanvasColorPreset": {
34-
"enum": [1, 2, 3, 4, 5, 6],
35-
"type": "number"
24+
},
25+
"additionalProperties": {}
3626
},
3727
"JSONCanvasEdge": {
38-
"additionalProperties": false,
28+
"type": "object",
3929
"properties": {
4030
"color": {
4131
"$ref": "#/definitions/JSONCanvasColor"
@@ -62,38 +52,89 @@
6252
"$ref": "#/definitions/JSONCanvasEdgeSide"
6353
}
6454
},
65-
"required": ["id", "fromNode", "toNode"],
66-
"type": "object"
55+
"required": [
56+
"fromNode",
57+
"id",
58+
"toNode"
59+
],
60+
"additionalProperties": false
6761
},
68-
"JSONCanvasEdgeEnd": {
69-
"enum": ["none", "arrow"],
70-
"type": "string"
62+
"JSONCanvasColor": {
63+
"anyOf": [
64+
{
65+
"type": "string"
66+
},
67+
{
68+
"$ref": "#/definitions/JSONCanvasColorPreset"
69+
}
70+
]
71+
},
72+
"JSONCanvasColorPreset": {
73+
"type": "number",
74+
"enum": [
75+
1,
76+
2,
77+
3,
78+
4,
79+
5,
80+
6
81+
]
7182
},
7283
"JSONCanvasEdgeSide": {
73-
"enum": ["top", "right", "bottom", "left"],
74-
"type": "string"
84+
"type": "string",
85+
"enum": [
86+
"top",
87+
"right",
88+
"bottom",
89+
"left"
90+
]
7591
},
76-
"JSONCanvasFileNode": {
77-
"additionalProperties": false,
92+
"JSONCanvasEdgeEnd": {
93+
"type": "string",
94+
"enum": [
95+
"none",
96+
"arrow"
97+
]
98+
},
99+
"JSONCanvasNode": {
100+
"anyOf": [
101+
{
102+
"$ref": "#/definitions/JSONCanvasNodeType"
103+
},
104+
{
105+
"$ref": "#/definitions/JSONCanvasTextNode"
106+
},
107+
{
108+
"$ref": "#/definitions/JSONCanvasFileNode"
109+
},
110+
{
111+
"$ref": "#/definitions/JSONCanvasLinkNode"
112+
},
113+
{
114+
"$ref": "#/definitions/JSONCanvasGroupNode"
115+
}
116+
]
117+
},
118+
"JSONCanvasNodeType": {
119+
"type": "object",
78120
"properties": {
79121
"color": {
80122
"$ref": "#/definitions/JSONCanvasColor"
81123
},
82-
"file": {
83-
"type": "string"
84-
},
85124
"height": {
86125
"type": "number"
87126
},
88127
"id": {
89128
"type": "string"
90129
},
91-
"subpath": {
92-
"type": "string"
93-
},
94130
"type": {
95-
"const": "file",
96-
"type": "string"
131+
"type": "string",
132+
"enum": [
133+
"text",
134+
"file",
135+
"link",
136+
"group"
137+
]
97138
},
98139
"width": {
99140
"type": "number"
@@ -105,19 +146,19 @@
105146
"type": "number"
106147
}
107148
},
108-
"required": ["file", "height", "id", "type", "width", "x", "y"],
109-
"type": "object"
149+
"required": [
150+
"height",
151+
"id",
152+
"type",
153+
"width",
154+
"x",
155+
"y"
156+
],
157+
"additionalProperties": false
110158
},
111-
"JSONCanvasGroupNode": {
112-
"additionalProperties": false,
159+
"JSONCanvasTextNode": {
160+
"type": "object",
113161
"properties": {
114-
"background": {
115-
"type": "string"
116-
},
117-
"backgroundStyle": {
118-
"enum": ["cover", "ratio", "repeat"],
119-
"type": "string"
120-
},
121162
"color": {
122163
"$ref": "#/definitions/JSONCanvasColor"
123164
},
@@ -127,12 +168,12 @@
127168
"id": {
128169
"type": "string"
129170
},
130-
"label": {
171+
"text": {
131172
"type": "string"
132173
},
133174
"type": {
134-
"const": "group",
135-
"type": "string"
175+
"type": "string",
176+
"const": "text"
136177
},
137178
"width": {
138179
"type": "number"
@@ -144,27 +185,38 @@
144185
"type": "number"
145186
}
146187
},
147-
"required": ["height", "id", "type", "width", "x", "y"],
148-
"type": "object"
188+
"required": [
189+
"height",
190+
"id",
191+
"text",
192+
"type",
193+
"width",
194+
"x",
195+
"y"
196+
],
197+
"additionalProperties": false
149198
},
150-
"JSONCanvasLinkNode": {
151-
"additionalProperties": false,
199+
"JSONCanvasFileNode": {
200+
"type": "object",
152201
"properties": {
153202
"color": {
154203
"$ref": "#/definitions/JSONCanvasColor"
155204
},
205+
"file": {
206+
"type": "string"
207+
},
156208
"height": {
157209
"type": "number"
158210
},
159211
"id": {
160212
"type": "string"
161213
},
162-
"type": {
163-
"const": "link",
214+
"subpath": {
164215
"type": "string"
165216
},
166-
"url": {
167-
"type": "string"
217+
"type": {
218+
"type": "string",
219+
"const": "file"
168220
},
169221
"width": {
170222
"type": "number"
@@ -176,30 +228,19 @@
176228
"type": "number"
177229
}
178230
},
179-
"required": ["height", "id", "type", "url", "width", "x", "y"],
180-
"type": "object"
231+
"required": [
232+
"file",
233+
"height",
234+
"id",
235+
"type",
236+
"width",
237+
"x",
238+
"y"
239+
],
240+
"additionalProperties": false
181241
},
182-
"JSONCanvasNode": {
183-
"anyOf": [
184-
{
185-
"$ref": "#/definitions/JSONCanvasNodeType"
186-
},
187-
{
188-
"$ref": "#/definitions/JSONCanvasTextNode"
189-
},
190-
{
191-
"$ref": "#/definitions/JSONCanvasFileNode"
192-
},
193-
{
194-
"$ref": "#/definitions/JSONCanvasLinkNode"
195-
},
196-
{
197-
"$ref": "#/definitions/JSONCanvasGroupNode"
198-
}
199-
]
200-
},
201-
"JSONCanvasNodeType": {
202-
"additionalProperties": false,
242+
"JSONCanvasLinkNode": {
243+
"type": "object",
203244
"properties": {
204245
"color": {
205246
"$ref": "#/definitions/JSONCanvasColor"
@@ -211,7 +252,10 @@
211252
"type": "string"
212253
},
213254
"type": {
214-
"enum": ["text", "file", "link", "group"],
255+
"type": "string",
256+
"const": "link"
257+
},
258+
"url": {
215259
"type": "string"
216260
},
217261
"width": {
@@ -224,12 +268,31 @@
224268
"type": "number"
225269
}
226270
},
227-
"required": ["id", "type", "x", "y", "width", "height"],
228-
"type": "object"
271+
"required": [
272+
"height",
273+
"id",
274+
"type",
275+
"url",
276+
"width",
277+
"x",
278+
"y"
279+
],
280+
"additionalProperties": false
229281
},
230-
"JSONCanvasTextNode": {
231-
"additionalProperties": false,
282+
"JSONCanvasGroupNode": {
283+
"type": "object",
232284
"properties": {
285+
"background": {
286+
"type": "string"
287+
},
288+
"backgroundStyle": {
289+
"type": "string",
290+
"enum": [
291+
"cover",
292+
"ratio",
293+
"repeat"
294+
]
295+
},
233296
"color": {
234297
"$ref": "#/definitions/JSONCanvasColor"
235298
},
@@ -239,12 +302,12 @@
239302
"id": {
240303
"type": "string"
241304
},
242-
"text": {
305+
"label": {
243306
"type": "string"
244307
},
245308
"type": {
246-
"const": "text",
247-
"type": "string"
309+
"type": "string",
310+
"const": "group"
248311
},
249312
"width": {
250313
"type": "number"
@@ -256,8 +319,15 @@
256319
"type": "number"
257320
}
258321
},
259-
"required": ["height", "id", "text", "type", "width", "x", "y"],
260-
"type": "object"
322+
"required": [
323+
"height",
324+
"id",
325+
"type",
326+
"width",
327+
"x",
328+
"y"
329+
],
330+
"additionalProperties": false
261331
}
262332
}
263333
}

0 commit comments

Comments
 (0)