summaryrefslogtreecommitdiff
path: root/conformance/scenario-schema.json
blob: 10fde2243c0af85641936ba2645a092dbba63b05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://clever-f.invalid/conformance/scenario-schema.json",
  "title": "clever-f host-neutral conformance scenarios",
  "type": "object",
  "required": ["format_version", "scenarios"],
  "additionalProperties": false,
  "properties": {
    "format_version": { "const": 1 },
    "scenarios": {
      "type": "array",
      "items": { "$ref": "#/$defs/scenario" }
    }
  },
  "$defs": {
    "position": {
      "type": "object",
      "required": ["line", "byte_column"],
      "additionalProperties": false,
      "properties": {
        "line": { "type": "integer", "minimum": 1 },
        "byte_column": { "type": "integer", "minimum": 1 }
      }
    },
    "selection": {
      "type": "object",
      "required": ["active", "kind", "anchor", "focus", "option"],
      "additionalProperties": false,
      "properties": {
        "active": { "type": "boolean" },
        "kind": {
          "enum": ["none", "character", "line", "block"]
        },
        "anchor": {
          "oneOf": [
            { "$ref": "#/$defs/position" },
            { "type": "null" }
          ]
        },
        "focus": {
          "oneOf": [
            { "$ref": "#/$defs/position" },
            { "type": "null" }
          ]
        },
        "option": { "enum": ["inclusive", "exclusive"] }
      }
    },
    "target": {
      "type": "object",
      "required": ["kind", "value", "first_code"],
      "additionalProperties": false,
      "properties": {
        "kind": { "enum": ["character", "special_key", "code_fallback"] },
        "value": { "type": "string" },
        "first_code": { "type": "integer", "minimum": 0 }
      }
    },
    "context_record": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "previous_descriptor": {
          "oneOf": [
            { "enum": ["f", "F", "t", "T"] },
            { "type": "null" }
          ]
        },
        "previous_landing": {
          "oneOf": [
            { "$ref": "#/$defs/position" },
            { "type": "null" }
          ]
        },
        "first_move": {
          "oneOf": [
            { "type": "boolean" },
            { "type": "null" }
          ]
        },
        "previous_target": {
          "oneOf": [
            { "$ref": "#/$defs/target" },
            { "type": "null" }
          ]
        }
      }
    },
    "state": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "contexts": {
          "type": "object",
          "additionalProperties": { "$ref": "#/$defs/context_record" }
        },
        "last_input_context": {
          "oneOf": [
            { "type": "string" },
            { "type": "null" }
          ]
        },
        "moved_forward": { "type": "boolean" },
        "moved_forward_initialized": { "type": "boolean" },
        "migemo_cache": {
          "type": "array",
          "items": { "type": "string" },
          "uniqueItems": true
        },
        "repeat_timestamp_ms": { "type": "number" },
        "highlight_timer": {
          "oneOf": [
            { "type": "string" },
            { "type": "null" }
          ]
        },
        "target_overlays": {
          "type": "array",
          "items": { "type": "string" },
          "uniqueItems": true
        },
        "temporary_overlays": {
          "type": "array",
          "items": { "type": "string" },
          "uniqueItems": true
        },
        "finalizers": {
          "type": "array",
          "items": { "type": "string" },
          "uniqueItems": true
        }
      }
    },
    "input_packet": {
      "type": "object",
      "required": ["kind"],
      "additionalProperties": false,
      "properties": {
        "kind": { "enum": ["text", "raw_bytes", "special_key", "error"] },
        "text": { "type": "string" },
        "bytes": {
          "type": "array",
          "items": { "type": "integer", "minimum": 0, "maximum": 255 }
        },
        "name": { "type": "string" },
        "message": { "type": "string" }
      }
    },
    "event": {
      "type": "object",
      "required": ["name"],
      "additionalProperties": false,
      "properties": {
        "name": {
          "enum": [
            "CursorMoved",
            "InsertEnter",
            "TextChanged",
            "WinEnter",
            "WinLeave",
            "CmdwinLeave",
            "ColorScheme"
          ]
        },
        "time_ms": { "type": "number" },
        "cursor": { "$ref": "#/$defs/position" },
        "buffer_lines": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    },
    "configuration_value": {
      "oneOf": [
        { "type": "boolean" },
        { "type": "integer" },
        { "type": "string" },
        { "type": "array", "items": { "type": "string" } },
        { "type": "null" }
      ]
    },
    "action_step": {
      "type": "object",
      "required": ["operation"],
      "additionalProperties": false,
      "properties": {
        "operation": {
          "enum": ["action", "event", "timer_callback", "set_cursor", "set_mode", "set_selection", "set_state", "editor_key"]
        },
        "action": {
          "enum": [
            "StartFindForward",
            "StartFindBackward",
            "StartTillForward",
            "StartTillBackward",
            "RepeatSameDirection",
            "RepeatOppositeDirection",
            "Reset",
            "DiagnosticFullReset",
            "DotRepeat"
          ]
        },
        "event_index": { "type": "integer", "minimum": 0 },
        "timer_identity": { "type": "string" },
        "position": { "$ref": "#/$defs/position" },
        "mode": { "type": "string" },
        "selection": { "$ref": "#/$defs/selection" },
        "state": { "$ref": "#/$defs/state" },
        "key": { "type": "string" },
        "count": {
          "oneOf": [
            { "type": "integer", "minimum": 1 },
            { "type": "null" }
          ]
        },
        "input_packet_indexes": {
          "type": "array",
          "items": { "type": "integer", "minimum": 0 }
        },
        "time_value_indexes": {
          "type": "array",
          "items": { "type": "integer", "minimum": 0 }
        }
      }
    },
    "action_outcome": {
      "type": "object",
      "required": ["after_step", "kind", "position", "complete", "successful_steps"],
      "additionalProperties": false,
      "properties": {
        "after_step": { "type": "integer", "minimum": 0 },
        "kind": {
          "enum": ["movement", "neutral", "escape", "failed_search", "error", "empty"]
        },
        "position": { "$ref": "#/$defs/position" },
        "complete": {
          "oneOf": [
            { "type": "boolean" },
            { "type": "null" }
          ]
        },
        "successful_steps": { "type": "integer", "minimum": 0 },
        "effective_descriptor": {
          "oneOf": [
            { "enum": ["f", "F", "t", "T"] },
            { "type": "null" }
          ]
        },
        "buffer_lines": {
          "type": "array",
          "items": { "type": "string" }
        },
        "dot_payload": {
          "type": "object",
          "required": ["descriptor", "target"],
          "additionalProperties": false,
          "properties": {
            "descriptor": { "enum": ["f", "F", "t", "T"] },
            "target": { "$ref": "#/$defs/target" }
          }
        }
      }
    },
    "state_snapshot": {
      "type": "object",
      "required": ["after_step", "state", "retained_fields", "cleared_fields"],
      "additionalProperties": false,
      "properties": {
        "after_step": { "type": "integer", "minimum": 0 },
        "state": { "$ref": "#/$defs/state" },
        "retained_fields": {
          "type": "array",
          "items": { "type": "string" },
          "uniqueItems": true
        },
        "cleared_fields": {
          "type": "array",
          "items": { "type": "string" },
          "uniqueItems": true
        }
      }
    },
    "overlay_plan": {
      "type": "object",
      "required": ["after_step", "operation", "group", "identity"],
      "additionalProperties": false,
      "properties": {
        "after_step": { "type": "integer", "minimum": 0 },
        "operation": { "enum": ["create", "remove", "rebuild", "preserve"] },
        "group": { "enum": ["CleverFCursor", "CleverFChar", "CleverFDirect"] },
        "identity": { "type": "string" },
        "window": { "type": "string" },
        "anchor_line": { "type": "integer", "minimum": 1 },
        "positions": {
          "type": "array",
          "items": { "$ref": "#/$defs/position" }
        },
        "priority": { "enum": ["ordinary", "high"] },
        "descriptor": { "enum": ["f", "F", "t", "T"] },
        "target_plan": { "type": "string" }
      }
    },
    "timer_operation": {
      "type": "object",
      "required": ["after_step", "operation", "identity"],
      "additionalProperties": false,
      "properties": {
        "after_step": { "type": "integer", "minimum": 0 },
        "operation": { "enum": ["start", "stop", "fire", "ignore", "set_inactive"] },
        "identity": { "type": "string" },
        "delay_ms": { "type": "integer", "minimum": 0 }
      }
    },
    "redraw": {
      "type": "object",
      "required": ["after_step", "kind"],
      "additionalProperties": false,
      "properties": {
        "after_step": { "type": "integer", "minimum": 0 },
        "kind": { "enum": ["screen", "full", "suppressed"] }
      }
    },
    "diagnostic": {
      "type": "object",
      "required": ["after_step", "level", "text"],
      "additionalProperties": false,
      "properties": {
        "after_step": { "type": "integer", "minimum": 0 },
        "level": { "enum": ["error", "warning", "info"] },
        "text": { "type": "string" }
      }
    },
    "host_operation": {
      "type": "object",
      "required": ["after_step", "operation"],
      "additionalProperties": false,
      "properties": {
        "after_step": { "type": "integer", "minimum": 0 },
        "operation": {
          "enum": [
            "open_fold",
            "apply_cursor",
            "apply_selection",
            "read_input",
            "hide_cursor_presentation",
            "restore_cursor_presentation",
            "register_finalizer",
            "remove_finalizer"
          ]
        },
        "identity": { "type": "string" },
        "position": { "$ref": "#/$defs/position" },
        "fold_level": { "type": "integer", "minimum": 1 }
      }
    },
    "scenario": {
      "type": "object",
      "required": [
        "id",
        "title",
        "source_refs",
        "requirements",
        "given",
        "steps",
        "expect"
      ],
      "additionalProperties": false,
      "properties": {
        "id": { "type": "string", "pattern": "^SCN-[0-9]{4}-[A-Z0-9-]+$" },
        "title": { "type": "string" },
        "source_refs": {
          "type": "array",
          "items": { "type": "string" },
          "minItems": 1,
          "uniqueItems": true
        },
        "requirements": {
          "type": "array",
          "items": { "type": "string", "pattern": "^CF-[0-9]{4}-[0-9]{3}$" },
          "minItems": 1,
          "uniqueItems": true
        },
        "given": {
          "type": "object",
          "required": [
            "buffer",
            "effective_encoding",
            "cursor",
            "mode",
            "selection",
            "pending_operator",
            "count",
            "configuration",
            "input_packets",
            "time_values_ms",
            "events",
            "state",
            "host"
          ],
          "additionalProperties": false,
          "properties": {
            "buffer": {
              "type": "object",
              "required": ["lines"],
              "additionalProperties": false,
              "properties": {
                "lines": {
                  "type": "array",
                  "items": { "type": "string" },
                  "minItems": 1
                }
              }
            },
            "effective_encoding": { "type": "string" },
            "cursor": { "$ref": "#/$defs/position" },
            "mode": { "type": "string", "minLength": 1 },
            "selection": { "$ref": "#/$defs/selection" },
            "pending_operator": {
              "oneOf": [
                { "type": "string" },
                { "type": "null" }
              ]
            },
            "count": {
              "oneOf": [
                { "type": "integer", "minimum": 1 },
                { "type": "null" }
              ]
            },
            "configuration": {
              "type": "object",
              "additionalProperties": { "$ref": "#/$defs/configuration_value" }
            },
            "input_packets": {
              "type": "array",
              "items": { "$ref": "#/$defs/input_packet" }
            },
            "time_values_ms": {
              "type": "array",
              "items": { "type": "number" }
            },
            "events": {
              "type": "array",
              "items": { "$ref": "#/$defs/event" }
            },
            "state": { "$ref": "#/$defs/state" },
            "host": {
              "type": "object",
              "required": ["macro_register", "fold_open_policy", "closed_fold_levels", "timer_support", "cmdline_cursor_support"],
              "additionalProperties": false,
              "properties": {
                "macro_register": {
                  "oneOf": [
                    { "type": "string" },
                    { "type": "null" }
                  ]
                },
                "fold_open_policy": {
                  "type": "array",
                  "items": { "enum": ["all", "horizontal", "vertical", "block", "insert", "jump", "mark", "percent", "quickfix", "search", "tag", "undo"] },
                  "uniqueItems": true
                },
                "closed_fold_levels": { "type": "integer", "minimum": 0 },
                "timer_support": { "type": "boolean" },
                "cmdline_cursor_support": { "type": "boolean" }
              }
            }
          }
        },
        "steps": {
          "type": "array",
          "items": { "$ref": "#/$defs/action_step" },
          "minItems": 1
        },
        "expect": {
          "type": "object",
          "required": [
            "action_outcomes",
            "final_buffer",
            "final_position",
            "final_selection",
            "state_snapshots",
            "overlay_plans",
            "timer_operations",
            "prompts",
            "redraws",
            "diagnostics",
            "host_operations"
          ],
          "additionalProperties": false,
          "properties": {
            "action_outcomes": {
              "type": "array",
              "items": { "$ref": "#/$defs/action_outcome" }
            },
            "final_buffer": {
              "type": "array",
              "items": { "type": "string" },
              "minItems": 1
            },
            "final_position": { "$ref": "#/$defs/position" },
            "final_selection": { "$ref": "#/$defs/selection" },
            "state_snapshots": {
              "type": "array",
              "items": { "$ref": "#/$defs/state_snapshot" }
            },
            "overlay_plans": {
              "type": "array",
              "items": { "$ref": "#/$defs/overlay_plan" }
            },
            "timer_operations": {
              "type": "array",
              "items": { "$ref": "#/$defs/timer_operation" }
            },
            "prompts": {
              "type": "array",
              "items": { "type": "string" }
            },
            "redraws": {
              "type": "array",
              "items": { "$ref": "#/$defs/redraw" }
            },
            "diagnostics": {
              "type": "array",
              "items": { "$ref": "#/$defs/diagnostic" }
            },
            "host_operations": {
              "type": "array",
              "items": { "$ref": "#/$defs/host_operation" }
            }
          }
        }
      }
    }
  }
}