@openplanr/protocol 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,506 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openplanr.dev/schemas/v1.22.0/design-document.schema.json",
4
+ "x-openplanr-contract": {
5
+ "id": "design-document",
6
+ "version": "1.22.0"
7
+ },
8
+ "title": "OpenPlanr authored design document",
9
+ "type": "object",
10
+ "additionalProperties": false,
11
+ "required": [
12
+ "kind",
13
+ "schemaVersion",
14
+ "id",
15
+ "title",
16
+ "brief",
17
+ "frames",
18
+ "screens",
19
+ "screenOrder",
20
+ "variants",
21
+ "selectedVariant",
22
+ "defaultView"
23
+ ],
24
+ "properties": {
25
+ "kind": {
26
+ "const": "openplanr-design-document"
27
+ },
28
+ "schemaVersion": {
29
+ "enum": [
30
+ "1.0.0",
31
+ "1.1.0"
32
+ ]
33
+ },
34
+ "id": {
35
+ "$ref": "#/$defs/id"
36
+ },
37
+ "title": {
38
+ "$ref": "#/$defs/text"
39
+ },
40
+ "brief": {
41
+ "type": "object",
42
+ "additionalProperties": false,
43
+ "required": [
44
+ "text",
45
+ "source",
46
+ "provenance"
47
+ ],
48
+ "properties": {
49
+ "text": {
50
+ "$ref": "#/$defs/text"
51
+ },
52
+ "source": {
53
+ "enum": [
54
+ "spec",
55
+ "png",
56
+ "describe"
57
+ ]
58
+ },
59
+ "provenance": {
60
+ "enum": [
61
+ "spec",
62
+ "inferred"
63
+ ]
64
+ },
65
+ "references": {
66
+ "type": "array",
67
+ "items": {
68
+ "$ref": "#/$defs/text"
69
+ },
70
+ "uniqueItems": true
71
+ }
72
+ }
73
+ },
74
+ "designSystem": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "properties": {
78
+ "path": {
79
+ "$ref": "#/$defs/localPath"
80
+ },
81
+ "tokens": {
82
+ "$ref": "#/$defs/localPath"
83
+ },
84
+ "spacing": {
85
+ "type": "array",
86
+ "minItems": 1,
87
+ "uniqueItems": true,
88
+ "items": {
89
+ "type": "number",
90
+ "minimum": 0,
91
+ "maximum": 16384
92
+ }
93
+ }
94
+ }
95
+ },
96
+ "assets": {
97
+ "$ref": "#/$defs/paths"
98
+ },
99
+ "frames": {
100
+ "type": "array",
101
+ "minItems": 1,
102
+ "items": {
103
+ "type": "object",
104
+ "additionalProperties": false,
105
+ "required": [
106
+ "id",
107
+ "label",
108
+ "width",
109
+ "height"
110
+ ],
111
+ "properties": {
112
+ "id": {
113
+ "$ref": "#/$defs/id"
114
+ },
115
+ "label": {
116
+ "$ref": "#/$defs/text"
117
+ },
118
+ "width": {
119
+ "type": "integer",
120
+ "minimum": 1,
121
+ "maximum": 16384
122
+ },
123
+ "height": {
124
+ "anyOf": [
125
+ {
126
+ "type": "integer",
127
+ "minimum": 1,
128
+ "maximum": 16384
129
+ },
130
+ {
131
+ "const": "auto"
132
+ }
133
+ ]
134
+ }
135
+ }
136
+ }
137
+ },
138
+ "screens": {
139
+ "type": "array",
140
+ "minItems": 1,
141
+ "items": {
142
+ "type": "object",
143
+ "additionalProperties": false,
144
+ "required": [
145
+ "id",
146
+ "title",
147
+ "source"
148
+ ],
149
+ "properties": {
150
+ "id": {
151
+ "$ref": "#/$defs/id"
152
+ },
153
+ "title": {
154
+ "$ref": "#/$defs/text"
155
+ },
156
+ "description": {
157
+ "$ref": "#/$defs/text"
158
+ },
159
+ "source": {
160
+ "$ref": "#/$defs/source"
161
+ },
162
+ "anchors": {
163
+ "$ref": "#/$defs/ids"
164
+ },
165
+ "props": {
166
+ "type": "object",
167
+ "propertyNames": {
168
+ "type": "string",
169
+ "minLength": 1,
170
+ "maxLength": 128,
171
+ "pattern": "^[a-z][a-z0-9-]*(?![\\s\\S])"
172
+ },
173
+ "additionalProperties": {
174
+ "oneOf": [
175
+ {
176
+ "type": "object",
177
+ "additionalProperties": false,
178
+ "required": [
179
+ "type",
180
+ "options",
181
+ "default"
182
+ ],
183
+ "properties": {
184
+ "type": {
185
+ "const": "enum"
186
+ },
187
+ "options": {
188
+ "type": "array",
189
+ "minItems": 1,
190
+ "uniqueItems": true,
191
+ "items": {
192
+ "type": "string",
193
+ "minLength": 1,
194
+ "maxLength": 128,
195
+ "pattern": "^[a-z][a-z0-9-]*(?![\\s\\S])"
196
+ }
197
+ },
198
+ "default": {
199
+ "type": "string",
200
+ "minLength": 1,
201
+ "maxLength": 128,
202
+ "pattern": "^[a-z][a-z0-9-]*(?![\\s\\S])"
203
+ }
204
+ }
205
+ },
206
+ {
207
+ "type": "object",
208
+ "additionalProperties": false,
209
+ "required": [
210
+ "type",
211
+ "default"
212
+ ],
213
+ "properties": {
214
+ "type": {
215
+ "const": "boolean"
216
+ },
217
+ "default": {
218
+ "type": "boolean"
219
+ }
220
+ }
221
+ }
222
+ ]
223
+ }
224
+ }
225
+ }
226
+ }
227
+ },
228
+ "screenOrder": {
229
+ "type": "array",
230
+ "minItems": 1,
231
+ "items": {
232
+ "$ref": "#/$defs/id"
233
+ },
234
+ "uniqueItems": true
235
+ },
236
+ "flows": {
237
+ "type": "array",
238
+ "items": {
239
+ "type": "object",
240
+ "additionalProperties": false,
241
+ "required": [
242
+ "id",
243
+ "title",
244
+ "screens"
245
+ ],
246
+ "properties": {
247
+ "id": {
248
+ "$ref": "#/$defs/id"
249
+ },
250
+ "title": {
251
+ "$ref": "#/$defs/text"
252
+ },
253
+ "screens": {
254
+ "type": "array",
255
+ "minItems": 1,
256
+ "items": {
257
+ "$ref": "#/$defs/id"
258
+ }
259
+ }
260
+ }
261
+ }
262
+ },
263
+ "variants": {
264
+ "type": "array",
265
+ "minItems": 1,
266
+ "items": {
267
+ "type": "object",
268
+ "additionalProperties": false,
269
+ "required": [
270
+ "id",
271
+ "label",
272
+ "status"
273
+ ],
274
+ "properties": {
275
+ "id": {
276
+ "$ref": "#/$defs/id"
277
+ },
278
+ "label": {
279
+ "$ref": "#/$defs/text"
280
+ },
281
+ "description": {
282
+ "$ref": "#/$defs/text"
283
+ },
284
+ "status": {
285
+ "enum": [
286
+ "ready",
287
+ "failed"
288
+ ]
289
+ },
290
+ "issue": {
291
+ "$ref": "#/$defs/text"
292
+ },
293
+ "sources": {
294
+ "type": "object",
295
+ "additionalProperties": {
296
+ "$ref": "#/$defs/source"
297
+ }
298
+ },
299
+ "props": {
300
+ "type": "object",
301
+ "propertyNames": {
302
+ "$ref": "#/$defs/id"
303
+ },
304
+ "additionalProperties": {
305
+ "type": "object",
306
+ "propertyNames": {
307
+ "type": "string",
308
+ "minLength": 1,
309
+ "maxLength": 128,
310
+ "pattern": "^[a-z][a-z0-9-]*(?![\\s\\S])"
311
+ },
312
+ "additionalProperties": {
313
+ "anyOf": [
314
+ {
315
+ "type": "string",
316
+ "minLength": 1,
317
+ "maxLength": 128,
318
+ "pattern": "^[a-z][a-z0-9-]*(?![\\s\\S])"
319
+ },
320
+ {
321
+ "type": "boolean"
322
+ }
323
+ ]
324
+ }
325
+ }
326
+ }
327
+ },
328
+ "if": {
329
+ "properties": {
330
+ "status": {
331
+ "const": "failed"
332
+ }
333
+ }
334
+ },
335
+ "then": {
336
+ "required": [
337
+ "issue"
338
+ ]
339
+ }
340
+ }
341
+ },
342
+ "selectedVariant": {
343
+ "$ref": "#/$defs/id"
344
+ },
345
+ "defaultView": {
346
+ "enum": [
347
+ "canvas",
348
+ "prototype",
349
+ "walkthrough"
350
+ ]
351
+ },
352
+ "layout": {
353
+ "type": "object",
354
+ "additionalProperties": false,
355
+ "properties": {
356
+ "boards": {
357
+ "type": "object",
358
+ "description": "Keys are screenId, screenId/frameId or screenId/frameId/variantId; each ID must exist in the document.",
359
+ "additionalProperties": {
360
+ "type": "object",
361
+ "additionalProperties": false,
362
+ "required": [
363
+ "x",
364
+ "y"
365
+ ],
366
+ "properties": {
367
+ "x": {
368
+ "$ref": "#/$defs/coordinate"
369
+ },
370
+ "y": {
371
+ "$ref": "#/$defs/coordinate"
372
+ },
373
+ "title": {
374
+ "$ref": "#/$defs/text"
375
+ }
376
+ }
377
+ }
378
+ },
379
+ "sections": {
380
+ "type": "array",
381
+ "items": {
382
+ "type": "object",
383
+ "additionalProperties": false,
384
+ "required": [
385
+ "id",
386
+ "x",
387
+ "y",
388
+ "text"
389
+ ],
390
+ "properties": {
391
+ "id": {
392
+ "$ref": "#/$defs/id"
393
+ },
394
+ "x": {
395
+ "$ref": "#/$defs/coordinate"
396
+ },
397
+ "y": {
398
+ "$ref": "#/$defs/coordinate"
399
+ },
400
+ "text": {
401
+ "$ref": "#/$defs/text"
402
+ },
403
+ "maxW": {
404
+ "type": "integer",
405
+ "minimum": 1,
406
+ "maximum": 16384
407
+ }
408
+ }
409
+ }
410
+ }
411
+ }
412
+ }
413
+ },
414
+ "$defs": {
415
+ "id": {
416
+ "type": "string",
417
+ "minLength": 1,
418
+ "maxLength": 128,
419
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]*$"
420
+ },
421
+ "text": {
422
+ "type": "string",
423
+ "minLength": 1,
424
+ "pattern": "\\S"
425
+ },
426
+ "ids": {
427
+ "type": "array",
428
+ "items": {
429
+ "$ref": "#/$defs/id"
430
+ },
431
+ "uniqueItems": true
432
+ },
433
+ "localPath": {
434
+ "type": "string",
435
+ "minLength": 1,
436
+ "description": "Path relative to the authored document directory. No URL, traversal, encoded path, query or fragment.",
437
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*//)(?!.*[/ ]$)[^\\\\:\\u0000-\\u001F%?#]+$"
438
+ },
439
+ "paths": {
440
+ "type": "array",
441
+ "items": {
442
+ "$ref": "#/$defs/localPath"
443
+ },
444
+ "uniqueItems": true
445
+ },
446
+ "source": {
447
+ "type": "object",
448
+ "additionalProperties": false,
449
+ "required": [
450
+ "html"
451
+ ],
452
+ "properties": {
453
+ "html": {
454
+ "$ref": "#/$defs/localPath"
455
+ },
456
+ "styles": {
457
+ "$ref": "#/$defs/paths"
458
+ },
459
+ "scripts": {
460
+ "$ref": "#/$defs/paths"
461
+ }
462
+ }
463
+ },
464
+ "coordinate": {
465
+ "type": "number",
466
+ "minimum": -10000000,
467
+ "maximum": 10000000
468
+ }
469
+ },
470
+ "allOf": [
471
+ {
472
+ "if": {
473
+ "properties": {
474
+ "schemaVersion": {
475
+ "const": "1.1.0"
476
+ }
477
+ },
478
+ "required": [
479
+ "schemaVersion"
480
+ ]
481
+ },
482
+ "else": {
483
+ "properties": {
484
+ "screens": {
485
+ "items": {
486
+ "not": {
487
+ "required": [
488
+ "props"
489
+ ]
490
+ }
491
+ }
492
+ },
493
+ "variants": {
494
+ "items": {
495
+ "not": {
496
+ "required": [
497
+ "props"
498
+ ]
499
+ }
500
+ }
501
+ }
502
+ }
503
+ }
504
+ }
505
+ ]
506
+ }