@botpress/cli 5.0.0 → 5.0.2

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.
Files changed (42) hide show
  1. package/.turbo/turbo-build.log +11 -11
  2. package/dist/command-implementations/lint-command.js +6 -3
  3. package/dist/command-implementations/lint-command.js.map +2 -2
  4. package/dist/linter/base-linter.d.ts +1 -1
  5. package/dist/linter/base-linter.js +23 -2
  6. package/dist/linter/base-linter.js.map +2 -2
  7. package/dist/linter/bot-linter.d.ts +2 -1
  8. package/dist/linter/bot-linter.js +2 -2
  9. package/dist/linter/bot-linter.js.map +2 -2
  10. package/dist/linter/integration-linter.d.ts +2 -1
  11. package/dist/linter/integration-linter.js +2 -2
  12. package/dist/linter/integration-linter.js.map +2 -2
  13. package/dist/linter/interface-linter.d.ts +2 -1
  14. package/dist/linter/interface-linter.js +2 -2
  15. package/dist/linter/interface-linter.js.map +2 -2
  16. package/dist/linter/ruleset-tests/bot.ruleset.test.js +322 -0
  17. package/dist/linter/ruleset-tests/bot.ruleset.test.js.map +2 -2
  18. package/dist/linter/ruleset-tests/integration.ruleset.test.js +713 -0
  19. package/dist/linter/ruleset-tests/integration.ruleset.test.js.map +2 -2
  20. package/dist/linter/ruleset-tests/interface.ruleset.test.js +502 -0
  21. package/dist/linter/ruleset-tests/interface.ruleset.test.js.map +2 -2
  22. package/dist/linter/rulesets/bot.ruleset.d.ts +12 -36
  23. package/dist/linter/rulesets/bot.ruleset.js +24 -6
  24. package/dist/linter/rulesets/bot.ruleset.js.map +2 -2
  25. package/dist/linter/rulesets/integration.ruleset.d.ts +27 -81
  26. package/dist/linter/rulesets/integration.ruleset.js +48 -16
  27. package/dist/linter/rulesets/integration.ruleset.js.map +2 -2
  28. package/dist/linter/rulesets/interface.ruleset.d.ts +10 -30
  29. package/dist/linter/rulesets/interface.ruleset.js +32 -8
  30. package/dist/linter/rulesets/interface.ruleset.js.map +2 -2
  31. package/dist/linter/spectral-functions.d.ts +25 -5
  32. package/dist/linter/spectral-functions.js +107 -6
  33. package/dist/linter/spectral-functions.js.map +2 -2
  34. package/dist/utils/file-watcher.d.ts +1 -1
  35. package/dist/utils/file-watcher.js +2 -2
  36. package/dist/utils/file-watcher.js.map +3 -3
  37. package/package.json +4 -2
  38. package/templates/empty-bot/package.json +1 -1
  39. package/templates/empty-integration/package.json +1 -1
  40. package/templates/empty-plugin/package.json +1 -1
  41. package/templates/hello-world/package.json +1 -1
  42. package/templates/webhook-message/package.json +1 -1
@@ -25,6 +25,24 @@ describeRule("action-inputparams-should-have-a-title", (lint) => {
25
25
  (0, import_vitest.expect)(results[0]?.path).toEqual(["actions", ACTION_NAME, "input", "schema", "properties", paramName, ZUI]);
26
26
  (0, import_vitest.expect)(results[0]?.message).toContain("title");
27
27
  });
28
+ import_vitest.test.each(PARAM_NAMES)("missing title with anyOf should trigger (%s)", async (paramName) => {
29
+ const definition = {
30
+ actions: {
31
+ [ACTION_NAME]: {
32
+ input: {
33
+ schema: {
34
+ properties: { [paramName]: { anyOf: [{ type: "object", [ZUI]: {} }, { type: "null" }], [ZUI]: {} } }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ };
40
+ const results = await lint(definition);
41
+ (0, import_vitest.expect)(results).toHaveLength(1);
42
+ (0, import_vitest.expect)(results[0]?.path).toEqual(["actions", ACTION_NAME, "input", "schema", "properties", paramName, ZUI]);
43
+ (0, import_vitest.expect)(results[0]?.message).toContain("title");
44
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
45
+ });
28
46
  import_vitest.test.each(PARAM_NAMES)("empty title should trigger (%s)", async (paramName) => {
29
47
  const definition = {
30
48
  actions: {
@@ -36,6 +54,40 @@ describeRule("action-inputparams-should-have-a-title", (lint) => {
36
54
  (0, import_vitest.expect)(results[0]?.path).toEqual(["actions", ACTION_NAME, "input", "schema", "properties", paramName, ZUI, "title"]);
37
55
  (0, import_vitest.expect)(results[0]?.message).toContain("title");
38
56
  });
57
+ import_vitest.test.each(PARAM_NAMES)("empty title nested in anyOf should trigger (%s)", async (paramName) => {
58
+ const definition = {
59
+ actions: {
60
+ [ACTION_NAME]: {
61
+ input: {
62
+ schema: {
63
+ properties: {
64
+ [paramName]: {
65
+ anyOf: [{ type: "object", [ZUI]: { title: EMPTY_STRING } }, { type: "null" }],
66
+ [ZUI]: {}
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+ };
74
+ const results = await lint(definition);
75
+ (0, import_vitest.expect)(results).toHaveLength(1);
76
+ (0, import_vitest.expect)(results[0]?.path).toEqual([
77
+ "actions",
78
+ ACTION_NAME,
79
+ "input",
80
+ "schema",
81
+ "properties",
82
+ paramName,
83
+ "anyOf",
84
+ "0",
85
+ ZUI,
86
+ "title"
87
+ ]);
88
+ (0, import_vitest.expect)(results[0]?.message).toContain("title");
89
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
90
+ });
39
91
  import_vitest.test.each(PARAM_NAMES)("valid title should not trigger (%s)", async (paramName) => {
40
92
  const definition = {
41
93
  actions: {
@@ -45,6 +97,26 @@ describeRule("action-inputparams-should-have-a-title", (lint) => {
45
97
  const results = await lint(definition);
46
98
  (0, import_vitest.expect)(results).toHaveLength(0);
47
99
  });
100
+ import_vitest.test.each(PARAM_NAMES)("valid title nested in anyOf should not trigger (%s)", async (paramName) => {
101
+ const definition = {
102
+ actions: {
103
+ [ACTION_NAME]: {
104
+ input: {
105
+ schema: {
106
+ properties: {
107
+ [paramName]: {
108
+ anyOf: [{ type: "object", [ZUI]: { title: TRUTHY_STRING } }, { type: "null" }],
109
+ [ZUI]: {}
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ };
117
+ const results = await lint(definition);
118
+ (0, import_vitest.expect)(results).toHaveLength(0);
119
+ });
48
120
  });
49
121
  describeRule("action-inputparams-must-have-a-description", (lint) => {
50
122
  import_vitest.test.each(PARAM_NAMES)("missing description should trigger (%s)", async (paramName) => {
@@ -56,6 +128,26 @@ describeRule("action-inputparams-must-have-a-description", (lint) => {
56
128
  (0, import_vitest.expect)(results[0]?.path).toEqual(["actions", ACTION_NAME, "input", "schema", "properties", paramName]);
57
129
  (0, import_vitest.expect)(results[0]?.message).toContain("description");
58
130
  });
131
+ import_vitest.test.each(PARAM_NAMES)("missing description with anyOf should trigger (%s)", async (paramName) => {
132
+ const definition = {
133
+ actions: {
134
+ [ACTION_NAME]: {
135
+ input: {
136
+ schema: {
137
+ properties: {
138
+ [paramName]: { anyOf: [{ type: "object" }, { type: "null" }] }
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
144
+ };
145
+ const results = await lint(definition);
146
+ (0, import_vitest.expect)(results).toHaveLength(1);
147
+ (0, import_vitest.expect)(results[0]?.path).toEqual(["actions", ACTION_NAME, "input", "schema", "properties", paramName]);
148
+ (0, import_vitest.expect)(results[0]?.message).toContain("description");
149
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
150
+ });
59
151
  import_vitest.test.each(PARAM_NAMES)("empty description should trigger (%s)", async (paramName) => {
60
152
  const definition = {
61
153
  actions: {
@@ -75,6 +167,36 @@ describeRule("action-inputparams-must-have-a-description", (lint) => {
75
167
  ]);
76
168
  (0, import_vitest.expect)(results[0]?.message).toContain("description");
77
169
  });
170
+ import_vitest.test.each(PARAM_NAMES)("empty description nested in anyOf should trigger (%s)", async (paramName) => {
171
+ const definition = {
172
+ actions: {
173
+ [ACTION_NAME]: {
174
+ input: {
175
+ schema: {
176
+ properties: {
177
+ [paramName]: { anyOf: [{ type: "object", description: EMPTY_STRING }, { type: "null" }] }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ }
183
+ };
184
+ const results = await lint(definition);
185
+ (0, import_vitest.expect)(results).toHaveLength(1);
186
+ (0, import_vitest.expect)(results[0]?.path).toEqual([
187
+ "actions",
188
+ ACTION_NAME,
189
+ "input",
190
+ "schema",
191
+ "properties",
192
+ paramName,
193
+ "anyOf",
194
+ "0",
195
+ "description"
196
+ ]);
197
+ (0, import_vitest.expect)(results[0]?.message).toContain("description");
198
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
199
+ });
78
200
  import_vitest.test.each(PARAM_NAMES)("valid description should not trigger (%s)", async (paramName) => {
79
201
  const definition = {
80
202
  actions: {
@@ -84,6 +206,23 @@ describeRule("action-inputparams-must-have-a-description", (lint) => {
84
206
  const results = await lint(definition);
85
207
  (0, import_vitest.expect)(results).toHaveLength(0);
86
208
  });
209
+ import_vitest.test.each(PARAM_NAMES)("valid description nested in anyOf should not trigger (%s)", async (paramName) => {
210
+ const definition = {
211
+ actions: {
212
+ [ACTION_NAME]: {
213
+ input: {
214
+ schema: {
215
+ properties: {
216
+ [paramName]: { anyOf: [{ type: "object", description: TRUTHY_STRING }, { type: "null" }] }
217
+ }
218
+ }
219
+ }
220
+ }
221
+ }
222
+ };
223
+ const results = await lint(definition);
224
+ (0, import_vitest.expect)(results).toHaveLength(0);
225
+ });
87
226
  });
88
227
  describeRule("action-outputparams-should-have-a-title", (lint) => {
89
228
  import_vitest.test.each(PARAM_NAMES)("missing title should trigger (%s)", async (paramName) => {
@@ -95,6 +234,24 @@ describeRule("action-outputparams-should-have-a-title", (lint) => {
95
234
  (0, import_vitest.expect)(results[0]?.path).toEqual(["actions", ACTION_NAME, "output", "schema", "properties", paramName, ZUI]);
96
235
  (0, import_vitest.expect)(results[0]?.message).toContain("title");
97
236
  });
237
+ import_vitest.test.each(PARAM_NAMES)("missing title with anyOf should trigger (%s)", async (paramName) => {
238
+ const definition = {
239
+ actions: {
240
+ [ACTION_NAME]: {
241
+ output: {
242
+ schema: {
243
+ properties: { [paramName]: { anyOf: [{ type: "object", [ZUI]: {} }, { type: "null" }], [ZUI]: {} } }
244
+ }
245
+ }
246
+ }
247
+ }
248
+ };
249
+ const results = await lint(definition);
250
+ (0, import_vitest.expect)(results).toHaveLength(1);
251
+ (0, import_vitest.expect)(results[0]?.path).toEqual(["actions", ACTION_NAME, "output", "schema", "properties", paramName, ZUI]);
252
+ (0, import_vitest.expect)(results[0]?.message).toContain("title");
253
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
254
+ });
98
255
  import_vitest.test.each(PARAM_NAMES)("empty title should trigger (%s)", async (paramName) => {
99
256
  const definition = {
100
257
  actions: {
@@ -115,6 +272,40 @@ describeRule("action-outputparams-should-have-a-title", (lint) => {
115
272
  ]);
116
273
  (0, import_vitest.expect)(results[0]?.message).toContain("title");
117
274
  });
275
+ import_vitest.test.each(PARAM_NAMES)("empty title nested in anyOf should trigger (%s)", async (paramName) => {
276
+ const definition = {
277
+ actions: {
278
+ [ACTION_NAME]: {
279
+ output: {
280
+ schema: {
281
+ properties: {
282
+ [paramName]: {
283
+ anyOf: [{ type: "object", [ZUI]: { title: EMPTY_STRING } }, { type: "null" }],
284
+ [ZUI]: {}
285
+ }
286
+ }
287
+ }
288
+ }
289
+ }
290
+ }
291
+ };
292
+ const results = await lint(definition);
293
+ (0, import_vitest.expect)(results).toHaveLength(1);
294
+ (0, import_vitest.expect)(results[0]?.path).toEqual([
295
+ "actions",
296
+ ACTION_NAME,
297
+ "output",
298
+ "schema",
299
+ "properties",
300
+ paramName,
301
+ "anyOf",
302
+ "0",
303
+ ZUI,
304
+ "title"
305
+ ]);
306
+ (0, import_vitest.expect)(results[0]?.message).toContain("title");
307
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
308
+ });
118
309
  import_vitest.test.each(PARAM_NAMES)("valid title should not trigger (%s)", async (paramName) => {
119
310
  const definition = {
120
311
  actions: {
@@ -124,6 +315,26 @@ describeRule("action-outputparams-should-have-a-title", (lint) => {
124
315
  const results = await lint(definition);
125
316
  (0, import_vitest.expect)(results).toHaveLength(0);
126
317
  });
318
+ import_vitest.test.each(PARAM_NAMES)("valid title nested in anyOf should not trigger (%s)", async (paramName) => {
319
+ const definition = {
320
+ actions: {
321
+ [ACTION_NAME]: {
322
+ output: {
323
+ schema: {
324
+ properties: {
325
+ [paramName]: {
326
+ anyOf: [{ type: "object", [ZUI]: { title: TRUTHY_STRING } }, { type: "null" }],
327
+ [ZUI]: {}
328
+ }
329
+ }
330
+ }
331
+ }
332
+ }
333
+ }
334
+ };
335
+ const results = await lint(definition);
336
+ (0, import_vitest.expect)(results).toHaveLength(0);
337
+ });
127
338
  });
128
339
  describeRule("action-outputparams-must-have-a-description", (lint) => {
129
340
  import_vitest.test.each(PARAM_NAMES)("missing description should trigger (%s)", async (paramName) => {
@@ -135,6 +346,20 @@ describeRule("action-outputparams-must-have-a-description", (lint) => {
135
346
  (0, import_vitest.expect)(results[0]?.path).toEqual(["actions", ACTION_NAME, "output", "schema", "properties", paramName]);
136
347
  (0, import_vitest.expect)(results[0]?.message).toContain("description");
137
348
  });
349
+ import_vitest.test.each(PARAM_NAMES)("missing description with anyOf should trigger (%s)", async (paramName) => {
350
+ const definition = {
351
+ actions: {
352
+ [ACTION_NAME]: {
353
+ output: { schema: { properties: { [paramName]: { anyOf: [{ type: "object" }, { type: "null" }] } } } }
354
+ }
355
+ }
356
+ };
357
+ const results = await lint(definition);
358
+ (0, import_vitest.expect)(results).toHaveLength(1);
359
+ (0, import_vitest.expect)(results[0]?.path).toEqual(["actions", ACTION_NAME, "output", "schema", "properties", paramName]);
360
+ (0, import_vitest.expect)(results[0]?.message).toContain("description");
361
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
362
+ });
138
363
  import_vitest.test.each(PARAM_NAMES)("empty description should trigger (%s)", async (paramName) => {
139
364
  const definition = {
140
365
  actions: {
@@ -154,6 +379,34 @@ describeRule("action-outputparams-must-have-a-description", (lint) => {
154
379
  ]);
155
380
  (0, import_vitest.expect)(results[0]?.message).toContain("description");
156
381
  });
382
+ import_vitest.test.each(PARAM_NAMES)("empty description nested in anyOf should trigger (%s)", async (paramName) => {
383
+ const definition = {
384
+ actions: {
385
+ [ACTION_NAME]: {
386
+ output: {
387
+ schema: {
388
+ properties: { [paramName]: { anyOf: [{ type: "object", description: EMPTY_STRING }, { type: "null" }] } }
389
+ }
390
+ }
391
+ }
392
+ }
393
+ };
394
+ const results = await lint(definition);
395
+ (0, import_vitest.expect)(results).toHaveLength(1);
396
+ (0, import_vitest.expect)(results[0]?.path).toEqual([
397
+ "actions",
398
+ ACTION_NAME,
399
+ "output",
400
+ "schema",
401
+ "properties",
402
+ paramName,
403
+ "anyOf",
404
+ "0",
405
+ "description"
406
+ ]);
407
+ (0, import_vitest.expect)(results[0]?.message).toContain("description");
408
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
409
+ });
157
410
  import_vitest.test.each(PARAM_NAMES)("valid description should not trigger (%s)", async (paramName) => {
158
411
  const definition = {
159
412
  actions: {
@@ -163,6 +416,23 @@ describeRule("action-outputparams-must-have-a-description", (lint) => {
163
416
  const results = await lint(definition);
164
417
  (0, import_vitest.expect)(results).toHaveLength(0);
165
418
  });
419
+ import_vitest.test.each(PARAM_NAMES)("valid description nested in anyOf should not trigger (%s)", async (paramName) => {
420
+ const definition = {
421
+ actions: {
422
+ [ACTION_NAME]: {
423
+ output: {
424
+ schema: {
425
+ properties: {
426
+ [paramName]: { anyOf: [{ type: "object", description: TRUTHY_STRING }, { type: "null" }] }
427
+ }
428
+ }
429
+ }
430
+ }
431
+ }
432
+ };
433
+ const results = await lint(definition);
434
+ (0, import_vitest.expect)(results).toHaveLength(0);
435
+ });
166
436
  });
167
437
  describeRule("event-outputparams-should-have-title", (lint) => {
168
438
  import_vitest.test.each(PARAM_NAMES)("missing title should trigger (%s)", async (paramName) => {
@@ -174,6 +444,22 @@ describeRule("event-outputparams-should-have-title", (lint) => {
174
444
  (0, import_vitest.expect)(results[0]?.path).toEqual(["events", EVENT_NAME, "schema", "properties", paramName, ZUI]);
175
445
  (0, import_vitest.expect)(results[0]?.message).toContain("title");
176
446
  });
447
+ import_vitest.test.each(PARAM_NAMES)("missing title with anyOf should trigger (%s)", async (paramName) => {
448
+ const definition = {
449
+ events: {
450
+ [EVENT_NAME]: {
451
+ schema: {
452
+ properties: { [paramName]: { anyOf: [{ type: "object", [ZUI]: {} }, { type: "null" }], [ZUI]: {} } }
453
+ }
454
+ }
455
+ }
456
+ };
457
+ const results = await lint(definition);
458
+ (0, import_vitest.expect)(results).toHaveLength(1);
459
+ (0, import_vitest.expect)(results[0]?.path).toEqual(["events", EVENT_NAME, "schema", "properties", paramName, ZUI]);
460
+ (0, import_vitest.expect)(results[0]?.message).toContain("title");
461
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
462
+ });
177
463
  import_vitest.test.each(PARAM_NAMES)("empty title should trigger (%s)", async (paramName) => {
178
464
  const definition = {
179
465
  events: {
@@ -185,6 +471,34 @@ describeRule("event-outputparams-should-have-title", (lint) => {
185
471
  (0, import_vitest.expect)(results[0]?.path).toEqual(["events", EVENT_NAME, "schema", "properties", paramName, ZUI, "title"]);
186
472
  (0, import_vitest.expect)(results[0]?.message).toContain("title");
187
473
  });
474
+ import_vitest.test.each(PARAM_NAMES)("empty title nested in anyOf should trigger (%s)", async (paramName) => {
475
+ const definition = {
476
+ events: {
477
+ [EVENT_NAME]: {
478
+ schema: {
479
+ properties: {
480
+ [paramName]: { anyOf: [{ type: "object", [ZUI]: { title: EMPTY_STRING } }, { type: "null" }], [ZUI]: {} }
481
+ }
482
+ }
483
+ }
484
+ }
485
+ };
486
+ const results = await lint(definition);
487
+ (0, import_vitest.expect)(results).toHaveLength(1);
488
+ (0, import_vitest.expect)(results[0]?.path).toEqual([
489
+ "events",
490
+ EVENT_NAME,
491
+ "schema",
492
+ "properties",
493
+ paramName,
494
+ "anyOf",
495
+ "0",
496
+ ZUI,
497
+ "title"
498
+ ]);
499
+ (0, import_vitest.expect)(results[0]?.message).toContain("title");
500
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
501
+ });
188
502
  import_vitest.test.each(PARAM_NAMES)("valid title should not trigger (%s)", async (paramName) => {
189
503
  const definition = {
190
504
  events: {
@@ -194,6 +508,24 @@ describeRule("event-outputparams-should-have-title", (lint) => {
194
508
  const results = await lint(definition);
195
509
  (0, import_vitest.expect)(results).toHaveLength(0);
196
510
  });
511
+ import_vitest.test.each(PARAM_NAMES)("valid title nested in anyOf should not trigger (%s)", async (paramName) => {
512
+ const definition = {
513
+ events: {
514
+ [EVENT_NAME]: {
515
+ schema: {
516
+ properties: {
517
+ [paramName]: {
518
+ anyOf: [{ type: "object", [ZUI]: { title: TRUTHY_STRING } }, { type: "null" }],
519
+ [ZUI]: {}
520
+ }
521
+ }
522
+ }
523
+ }
524
+ }
525
+ };
526
+ const results = await lint(definition);
527
+ (0, import_vitest.expect)(results).toHaveLength(0);
528
+ });
197
529
  });
198
530
  describeRule("event-outputparams-must-have-description", (lint) => {
199
531
  import_vitest.test.each(PARAM_NAMES)("missing description should trigger (%s)", async (paramName) => {
@@ -205,6 +537,22 @@ describeRule("event-outputparams-must-have-description", (lint) => {
205
537
  (0, import_vitest.expect)(results[0]?.path).toEqual(["events", EVENT_NAME, "schema", "properties", paramName]);
206
538
  (0, import_vitest.expect)(results[0]?.message).toContain("description");
207
539
  });
540
+ import_vitest.test.each(PARAM_NAMES)("missing description with anyOf should trigger (%s)", async (paramName) => {
541
+ const definition = {
542
+ events: {
543
+ [EVENT_NAME]: {
544
+ schema: {
545
+ properties: { [paramName]: { anyOf: [{ type: "object" }, { type: "null" }] } }
546
+ }
547
+ }
548
+ }
549
+ };
550
+ const results = await lint(definition);
551
+ (0, import_vitest.expect)(results).toHaveLength(1);
552
+ (0, import_vitest.expect)(results[0]?.path).toEqual(["events", EVENT_NAME, "schema", "properties", paramName]);
553
+ (0, import_vitest.expect)(results[0]?.message).toContain("description");
554
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
555
+ });
208
556
  import_vitest.test.each(PARAM_NAMES)("empty description should trigger (%s)", async (paramName) => {
209
557
  const definition = {
210
558
  events: {
@@ -216,6 +564,31 @@ describeRule("event-outputparams-must-have-description", (lint) => {
216
564
  (0, import_vitest.expect)(results[0]?.path).toEqual(["events", EVENT_NAME, "schema", "properties", paramName, "description"]);
217
565
  (0, import_vitest.expect)(results[0]?.message).toContain("description");
218
566
  });
567
+ import_vitest.test.each(PARAM_NAMES)("empty description nested in anyOf should trigger (%s)", async (paramName) => {
568
+ const definition = {
569
+ events: {
570
+ [EVENT_NAME]: {
571
+ schema: {
572
+ properties: { [paramName]: { anyOf: [{ type: "object", description: EMPTY_STRING }, { type: "null" }] } }
573
+ }
574
+ }
575
+ }
576
+ };
577
+ const results = await lint(definition);
578
+ (0, import_vitest.expect)(results).toHaveLength(1);
579
+ (0, import_vitest.expect)(results[0]?.path).toEqual([
580
+ "events",
581
+ EVENT_NAME,
582
+ "schema",
583
+ "properties",
584
+ paramName,
585
+ "anyOf",
586
+ "0",
587
+ "description"
588
+ ]);
589
+ (0, import_vitest.expect)(results[0]?.message).toContain("description");
590
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
591
+ });
219
592
  import_vitest.test.each(PARAM_NAMES)("valid description should not trigger (%s)", async (paramName) => {
220
593
  const definition = {
221
594
  events: {
@@ -225,6 +598,19 @@ describeRule("event-outputparams-must-have-description", (lint) => {
225
598
  const results = await lint(definition);
226
599
  (0, import_vitest.expect)(results).toHaveLength(0);
227
600
  });
601
+ import_vitest.test.each(PARAM_NAMES)("valid description nested in anyOf should not trigger (%s)", async (paramName) => {
602
+ const definition = {
603
+ events: {
604
+ [EVENT_NAME]: {
605
+ schema: {
606
+ properties: { [paramName]: { anyOf: [{ type: "object", description: TRUTHY_STRING }, { type: "null" }] } }
607
+ }
608
+ }
609
+ }
610
+ };
611
+ const results = await lint(definition);
612
+ (0, import_vitest.expect)(results).toHaveLength(0);
613
+ });
228
614
  });
229
615
  describeRule("legacy-zui-title-should-be-removed", (lint) => {
230
616
  import_vitest.test.each(PARAM_NAMES)("legacy zui title should trigger (%s)", async (paramName) => {
@@ -328,6 +714,22 @@ describeRule("entity-fields-should-have-a-title", (lint) => {
328
714
  (0, import_vitest.expect)(results[0]?.path).toEqual(["entities", ENTITY_NAME, "schema", "properties", paramName, ZUI]);
329
715
  (0, import_vitest.expect)(results[0]?.message).toContain("title");
330
716
  });
717
+ import_vitest.test.each(PARAM_NAMES)("missing title with anyOf should trigger (%s)", async (paramName) => {
718
+ const definition = {
719
+ entities: {
720
+ [ENTITY_NAME]: {
721
+ schema: {
722
+ properties: { [paramName]: { anyOf: [{ type: "object", [ZUI]: {} }, { type: "null" }], [ZUI]: {} } }
723
+ }
724
+ }
725
+ }
726
+ };
727
+ const results = await lint(definition);
728
+ (0, import_vitest.expect)(results).toHaveLength(1);
729
+ (0, import_vitest.expect)(results[0]?.path).toEqual(["entities", ENTITY_NAME, "schema", "properties", paramName, ZUI]);
730
+ (0, import_vitest.expect)(results[0]?.message).toContain("title");
731
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
732
+ });
331
733
  import_vitest.test.each(PARAM_NAMES)("empty title should trigger (%s)", async (paramName) => {
332
734
  const definition = {
333
735
  entities: {
@@ -339,6 +741,34 @@ describeRule("entity-fields-should-have-a-title", (lint) => {
339
741
  (0, import_vitest.expect)(results[0]?.path).toEqual(["entities", ENTITY_NAME, "schema", "properties", paramName, ZUI, "title"]);
340
742
  (0, import_vitest.expect)(results[0]?.message).toContain("title");
341
743
  });
744
+ import_vitest.test.each(PARAM_NAMES)("empty title nested in anyOf should trigger (%s)", async (paramName) => {
745
+ const definition = {
746
+ entities: {
747
+ [ENTITY_NAME]: {
748
+ schema: {
749
+ properties: {
750
+ [paramName]: { anyOf: [{ type: "object", [ZUI]: { title: EMPTY_STRING } }, { type: "null" }], [ZUI]: {} }
751
+ }
752
+ }
753
+ }
754
+ }
755
+ };
756
+ const results = await lint(definition);
757
+ (0, import_vitest.expect)(results).toHaveLength(1);
758
+ (0, import_vitest.expect)(results[0]?.path).toEqual([
759
+ "entities",
760
+ ENTITY_NAME,
761
+ "schema",
762
+ "properties",
763
+ paramName,
764
+ "anyOf",
765
+ "0",
766
+ ZUI,
767
+ "title"
768
+ ]);
769
+ (0, import_vitest.expect)(results[0]?.message).toContain("title");
770
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
771
+ });
342
772
  import_vitest.test.each(PARAM_NAMES)("valid title should not trigger (%s)", async (paramName) => {
343
773
  const definition = {
344
774
  entities: {
@@ -348,6 +778,24 @@ describeRule("entity-fields-should-have-a-title", (lint) => {
348
778
  const results = await lint(definition);
349
779
  (0, import_vitest.expect)(results).toHaveLength(0);
350
780
  });
781
+ import_vitest.test.each(PARAM_NAMES)("valid title nested in anyOf should not trigger (%s)", async (paramName) => {
782
+ const definition = {
783
+ entities: {
784
+ [ENTITY_NAME]: {
785
+ schema: {
786
+ properties: {
787
+ [paramName]: {
788
+ anyOf: [{ type: "object", [ZUI]: { title: TRUTHY_STRING } }, { type: "null" }],
789
+ [ZUI]: {}
790
+ }
791
+ }
792
+ }
793
+ }
794
+ }
795
+ };
796
+ const results = await lint(definition);
797
+ (0, import_vitest.expect)(results).toHaveLength(0);
798
+ });
351
799
  });
352
800
  describeRule("entity-fields-must-have-a-description", (lint) => {
353
801
  import_vitest.test.each(PARAM_NAMES)("missing description should trigger (%s)", async (paramName) => {
@@ -359,6 +807,22 @@ describeRule("entity-fields-must-have-a-description", (lint) => {
359
807
  (0, import_vitest.expect)(results[0]?.path).toEqual(["entities", ENTITY_NAME, "schema", "properties", paramName]);
360
808
  (0, import_vitest.expect)(results[0]?.message).toContain("description");
361
809
  });
810
+ import_vitest.test.each(PARAM_NAMES)("missing description with anyOf should trigger (%s)", async (paramName) => {
811
+ const definition = {
812
+ entities: {
813
+ [ENTITY_NAME]: {
814
+ schema: {
815
+ properties: { [paramName]: { anyOf: [{ type: "object" }, { type: "null" }] } }
816
+ }
817
+ }
818
+ }
819
+ };
820
+ const results = await lint(definition);
821
+ (0, import_vitest.expect)(results).toHaveLength(1);
822
+ (0, import_vitest.expect)(results[0]?.path).toEqual(["entities", ENTITY_NAME, "schema", "properties", paramName]);
823
+ (0, import_vitest.expect)(results[0]?.message).toContain("description");
824
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
825
+ });
362
826
  import_vitest.test.each(PARAM_NAMES)("empty description should trigger (%s)", async (paramName) => {
363
827
  const definition = {
364
828
  entities: {
@@ -370,6 +834,31 @@ describeRule("entity-fields-must-have-a-description", (lint) => {
370
834
  (0, import_vitest.expect)(results[0]?.path).toEqual(["entities", ENTITY_NAME, "schema", "properties", paramName, "description"]);
371
835
  (0, import_vitest.expect)(results[0]?.message).toContain("description");
372
836
  });
837
+ import_vitest.test.each(PARAM_NAMES)("empty description nested in anyOf should trigger (%s)", async (paramName) => {
838
+ const definition = {
839
+ entities: {
840
+ [ENTITY_NAME]: {
841
+ schema: {
842
+ properties: { [paramName]: { anyOf: [{ type: "object", description: EMPTY_STRING }, { type: "null" }] } }
843
+ }
844
+ }
845
+ }
846
+ };
847
+ const results = await lint(definition);
848
+ (0, import_vitest.expect)(results).toHaveLength(1);
849
+ (0, import_vitest.expect)(results[0]?.path).toEqual([
850
+ "entities",
851
+ ENTITY_NAME,
852
+ "schema",
853
+ "properties",
854
+ paramName,
855
+ "anyOf",
856
+ "0",
857
+ "description"
858
+ ]);
859
+ (0, import_vitest.expect)(results[0]?.message).toContain("description");
860
+ (0, import_vitest.expect)(results[0]?.message).toContain(paramName);
861
+ });
373
862
  import_vitest.test.each(PARAM_NAMES)("valid description should not trigger (%s)", async (paramName) => {
374
863
  const definition = {
375
864
  entities: {
@@ -379,5 +868,18 @@ describeRule("entity-fields-must-have-a-description", (lint) => {
379
868
  const results = await lint(definition);
380
869
  (0, import_vitest.expect)(results).toHaveLength(0);
381
870
  });
871
+ import_vitest.test.each(PARAM_NAMES)("valid description nested in anyOf should not trigger (%s)", async (paramName) => {
872
+ const definition = {
873
+ entities: {
874
+ [ENTITY_NAME]: {
875
+ schema: {
876
+ properties: { [paramName]: { anyOf: [{ type: "object", description: TRUTHY_STRING }, { type: "null" }] } }
877
+ }
878
+ }
879
+ }
880
+ };
881
+ const results = await lint(definition);
882
+ (0, import_vitest.expect)(results).toHaveLength(0);
883
+ });
382
884
  });
383
885
  //# sourceMappingURL=interface.ruleset.test.js.map