Commit b05619d
[Streams] Convert condition editor from JSON to YAML with schema validation (elastic#254445)
## Summary

Converts the condition editor component in the Streams app to use YAML
format instead of JSON, providing inline validation, suggestions, and
hover support via Monaco YAML with a schema derived from the condition
Zod schema.
**Key changes:**
- Add `getConditionJsonSchema()` and `getConditionMonacoSchemaConfig()`
functions to `@kbn/streamlang` for generating JSON Schema from the
`conditionSchema` Zod schema
- Create `conditionYamlService` singleton in streams_app for managing
monaco-yaml instance with reference counting (supports multiple editors
on the same page)
- Update `condition_editor.tsx` to use YAML with schema-based validation
instead of JSON
- Update unit tests to use YAML format (20/20 passing)
- Update Scout UI tests to use YAML syntax (12/12 passing)
## Test plan
- [ ] Verify condition editor displays YAML format
- [ ] Verify inline suggestions appear when typing in the condition
editor
- [ ] Verify validation errors show for invalid YAML syntax
- [ ] Verify hover information appears for condition fields
- [ ] Run unit tests: `yarn test:jest
x-pack/platform/plugins/shared/streams_app/public/components/data_management/shared/condition_editor.test.tsx`
- [ ] Run Scout UI tests: `node scripts/scout run-tests --arch stateful
--domain classic --config
x-pack/platform/plugins/shared/streams_app/test/scout/ui/configs/stateful/classic.config.ts
--testFiles
x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/`
Made with [Cursor](https://cursor.com)
---------
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 806c977 commit b05619d
8 files changed
Lines changed: 330 additions & 130 deletions
File tree
- x-pack/platform
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
Lines changed: 129 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
998 | 999 | | |
999 | 1000 | | |
1000 | 1001 | | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
Lines changed: 37 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
46 | 55 | | |
47 | 56 | | |
48 | 57 | | |
| |||
116 | 125 | | |
117 | 126 | | |
118 | 127 | | |
119 | | - | |
| 128 | + | |
120 | 129 | | |
121 | 130 | | |
122 | 131 | | |
| |||
135 | 144 | | |
136 | 145 | | |
137 | 146 | | |
138 | | - | |
| 147 | + | |
139 | 148 | | |
140 | 149 | | |
141 | 150 | | |
| |||
150 | 159 | | |
151 | 160 | | |
152 | 161 | | |
153 | | - | |
| 162 | + | |
154 | 163 | | |
155 | 164 | | |
156 | 165 | | |
| |||
169 | 178 | | |
170 | 179 | | |
171 | 180 | | |
172 | | - | |
| 181 | + | |
173 | 182 | | |
174 | 183 | | |
175 | 184 | | |
| |||
227 | 236 | | |
228 | 237 | | |
229 | 238 | | |
230 | | - | |
| 239 | + | |
231 | 240 | | |
232 | 241 | | |
233 | 242 | | |
| |||
259 | 268 | | |
260 | 269 | | |
261 | 270 | | |
262 | | - | |
| 271 | + | |
263 | 272 | | |
264 | 273 | | |
265 | 274 | | |
| |||
279 | 288 | | |
280 | 289 | | |
281 | 290 | | |
282 | | - | |
| 291 | + | |
283 | 292 | | |
284 | 293 | | |
285 | | - | |
| 294 | + | |
286 | 295 | | |
287 | 296 | | |
288 | 297 | | |
289 | 298 | | |
290 | | - | |
| 299 | + | |
291 | 300 | | |
292 | 301 | | |
293 | 302 | | |
| |||
307 | 316 | | |
308 | 317 | | |
309 | 318 | | |
310 | | - | |
311 | | - | |
312 | | - | |
| 319 | + | |
| 320 | + | |
313 | 321 | | |
314 | | - | |
| 322 | + | |
315 | 323 | | |
316 | 324 | | |
317 | 325 | | |
318 | 326 | | |
319 | | - | |
| 327 | + | |
320 | 328 | | |
321 | 329 | | |
322 | 330 | | |
| |||
337 | 345 | | |
338 | 346 | | |
339 | 347 | | |
340 | | - | |
341 | | - | |
342 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
343 | 351 | | |
344 | 352 | | |
345 | 353 | | |
346 | 354 | | |
347 | 355 | | |
348 | 356 | | |
349 | | - | |
| 357 | + | |
350 | 358 | | |
351 | 359 | | |
352 | 360 | | |
| |||
481 | 489 | | |
482 | 490 | | |
483 | 491 | | |
484 | | - | |
| 492 | + | |
485 | 493 | | |
486 | 494 | | |
487 | 495 | | |
| |||
496 | 504 | | |
497 | 505 | | |
498 | 506 | | |
499 | | - | |
| 507 | + | |
500 | 508 | | |
501 | 509 | | |
502 | 510 | | |
503 | 511 | | |
504 | 512 | | |
505 | | - | |
| 513 | + | |
506 | 514 | | |
507 | 515 | | |
508 | 516 | | |
| |||
517 | 525 | | |
518 | 526 | | |
519 | 527 | | |
520 | | - | |
| 528 | + | |
521 | 529 | | |
522 | 530 | | |
523 | 531 | | |
| |||
530 | 538 | | |
531 | 539 | | |
532 | 540 | | |
533 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
534 | 544 | | |
535 | 545 | | |
536 | | - | |
| 546 | + | |
537 | 547 | | |
538 | 548 | | |
539 | 549 | | |
| |||
549 | 559 | | |
550 | 560 | | |
551 | 561 | | |
552 | | - | |
553 | | - | |
554 | | - | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
555 | 565 | | |
556 | 566 | | |
557 | 567 | | |
| |||
0 commit comments