@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.
- package/.turbo/turbo-build.log +11 -11
- package/dist/command-implementations/lint-command.js +6 -3
- package/dist/command-implementations/lint-command.js.map +2 -2
- package/dist/linter/base-linter.d.ts +1 -1
- package/dist/linter/base-linter.js +23 -2
- package/dist/linter/base-linter.js.map +2 -2
- package/dist/linter/bot-linter.d.ts +2 -1
- package/dist/linter/bot-linter.js +2 -2
- package/dist/linter/bot-linter.js.map +2 -2
- package/dist/linter/integration-linter.d.ts +2 -1
- package/dist/linter/integration-linter.js +2 -2
- package/dist/linter/integration-linter.js.map +2 -2
- package/dist/linter/interface-linter.d.ts +2 -1
- package/dist/linter/interface-linter.js +2 -2
- package/dist/linter/interface-linter.js.map +2 -2
- package/dist/linter/ruleset-tests/bot.ruleset.test.js +322 -0
- package/dist/linter/ruleset-tests/bot.ruleset.test.js.map +2 -2
- package/dist/linter/ruleset-tests/integration.ruleset.test.js +713 -0
- package/dist/linter/ruleset-tests/integration.ruleset.test.js.map +2 -2
- package/dist/linter/ruleset-tests/interface.ruleset.test.js +502 -0
- package/dist/linter/ruleset-tests/interface.ruleset.test.js.map +2 -2
- package/dist/linter/rulesets/bot.ruleset.d.ts +12 -36
- package/dist/linter/rulesets/bot.ruleset.js +24 -6
- package/dist/linter/rulesets/bot.ruleset.js.map +2 -2
- package/dist/linter/rulesets/integration.ruleset.d.ts +27 -81
- package/dist/linter/rulesets/integration.ruleset.js +48 -16
- package/dist/linter/rulesets/integration.ruleset.js.map +2 -2
- package/dist/linter/rulesets/interface.ruleset.d.ts +10 -30
- package/dist/linter/rulesets/interface.ruleset.js +32 -8
- package/dist/linter/rulesets/interface.ruleset.js.map +2 -2
- package/dist/linter/spectral-functions.d.ts +25 -5
- package/dist/linter/spectral-functions.js +107 -6
- package/dist/linter/spectral-functions.js.map +2 -2
- package/dist/utils/file-watcher.d.ts +1 -1
- package/dist/utils/file-watcher.js +2 -2
- package/dist/utils/file-watcher.js.map +3 -3
- package/package.json +4 -2
- package/templates/empty-bot/package.json +1 -1
- package/templates/empty-integration/package.json +1 -1
- package/templates/empty-plugin/package.json +1 -1
- package/templates/hello-world/package.json +1 -1
- package/templates/webhook-message/package.json +1 -1
|
@@ -23,6 +23,22 @@ describeRule("event-outputparams-should-have-title", (lint) => {
|
|
|
23
23
|
(0, import_vitest.expect)(results[0]?.path).toEqual(["events", EVENT_NAME, "schema", "properties", paramName, ZUI]);
|
|
24
24
|
(0, import_vitest.expect)(results[0]?.message).toContain("title");
|
|
25
25
|
});
|
|
26
|
+
import_vitest.test.each(PARAM_NAMES)("missing title with anyOf should trigger (%s)", async (paramName) => {
|
|
27
|
+
const definition = {
|
|
28
|
+
events: {
|
|
29
|
+
[EVENT_NAME]: {
|
|
30
|
+
schema: {
|
|
31
|
+
properties: { [paramName]: { anyOf: [{ type: "object", [ZUI]: {} }, { type: "null" }], [ZUI]: {} } }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const results = await lint(definition);
|
|
37
|
+
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
38
|
+
(0, import_vitest.expect)(results[0]?.path).toEqual(["events", EVENT_NAME, "schema", "properties", paramName, ZUI]);
|
|
39
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("title");
|
|
40
|
+
(0, import_vitest.expect)(results[0]?.message).toContain(paramName);
|
|
41
|
+
});
|
|
26
42
|
import_vitest.test.each(PARAM_NAMES)("empty title should trigger (%s)", async (paramName) => {
|
|
27
43
|
const definition = {
|
|
28
44
|
events: {
|
|
@@ -34,6 +50,34 @@ describeRule("event-outputparams-should-have-title", (lint) => {
|
|
|
34
50
|
(0, import_vitest.expect)(results[0]?.path).toEqual(["events", EVENT_NAME, "schema", "properties", paramName, ZUI, "title"]);
|
|
35
51
|
(0, import_vitest.expect)(results[0]?.message).toContain("title");
|
|
36
52
|
});
|
|
53
|
+
import_vitest.test.each(PARAM_NAMES)("empty title nested in anyOf should trigger (%s)", async (paramName) => {
|
|
54
|
+
const definition = {
|
|
55
|
+
events: {
|
|
56
|
+
[EVENT_NAME]: {
|
|
57
|
+
schema: {
|
|
58
|
+
properties: {
|
|
59
|
+
[paramName]: { anyOf: [{ type: "object", [ZUI]: { title: EMPTY_STRING } }, { type: "null" }], [ZUI]: {} }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const results = await lint(definition);
|
|
66
|
+
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
67
|
+
(0, import_vitest.expect)(results[0]?.path).toEqual([
|
|
68
|
+
"events",
|
|
69
|
+
EVENT_NAME,
|
|
70
|
+
"schema",
|
|
71
|
+
"properties",
|
|
72
|
+
paramName,
|
|
73
|
+
"anyOf",
|
|
74
|
+
"0",
|
|
75
|
+
ZUI,
|
|
76
|
+
"title"
|
|
77
|
+
]);
|
|
78
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("title");
|
|
79
|
+
(0, import_vitest.expect)(results[0]?.message).toContain(paramName);
|
|
80
|
+
});
|
|
37
81
|
import_vitest.test.each(PARAM_NAMES)("valid title should not trigger (%s)", async (paramName) => {
|
|
38
82
|
const definition = {
|
|
39
83
|
events: {
|
|
@@ -43,6 +87,24 @@ describeRule("event-outputparams-should-have-title", (lint) => {
|
|
|
43
87
|
const results = await lint(definition);
|
|
44
88
|
(0, import_vitest.expect)(results).toHaveLength(0);
|
|
45
89
|
});
|
|
90
|
+
import_vitest.test.each(PARAM_NAMES)("valid title nested in anyOf should not trigger (%s)", async (paramName) => {
|
|
91
|
+
const definition = {
|
|
92
|
+
events: {
|
|
93
|
+
[EVENT_NAME]: {
|
|
94
|
+
schema: {
|
|
95
|
+
properties: {
|
|
96
|
+
[paramName]: {
|
|
97
|
+
anyOf: [{ type: "object", [ZUI]: { title: TRUTHY_STRING } }, { type: "null" }],
|
|
98
|
+
[ZUI]: {}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const results = await lint(definition);
|
|
106
|
+
(0, import_vitest.expect)(results).toHaveLength(0);
|
|
107
|
+
});
|
|
46
108
|
});
|
|
47
109
|
describeRule("event-outputparams-must-have-description", (lint) => {
|
|
48
110
|
import_vitest.test.each(PARAM_NAMES)("missing description should trigger (%s)", async (paramName) => {
|
|
@@ -54,6 +116,20 @@ describeRule("event-outputparams-must-have-description", (lint) => {
|
|
|
54
116
|
(0, import_vitest.expect)(results[0]?.path).toEqual(["events", EVENT_NAME, "schema", "properties", paramName]);
|
|
55
117
|
(0, import_vitest.expect)(results[0]?.message).toContain("description");
|
|
56
118
|
});
|
|
119
|
+
import_vitest.test.each(PARAM_NAMES)("missing description with anyOf should trigger (%s)", async (paramName) => {
|
|
120
|
+
const definition = {
|
|
121
|
+
events: {
|
|
122
|
+
[EVENT_NAME]: {
|
|
123
|
+
schema: { properties: { [paramName]: { anyOf: [{ type: "object" }, { type: "null" }] } } }
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const results = await lint(definition);
|
|
128
|
+
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
129
|
+
(0, import_vitest.expect)(results[0]?.path).toEqual(["events", EVENT_NAME, "schema", "properties", paramName]);
|
|
130
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("description");
|
|
131
|
+
(0, import_vitest.expect)(results[0]?.message).toContain(paramName);
|
|
132
|
+
});
|
|
57
133
|
import_vitest.test.each(PARAM_NAMES)("empty description should trigger (%s)", async (paramName) => {
|
|
58
134
|
const definition = {
|
|
59
135
|
events: {
|
|
@@ -65,6 +141,31 @@ describeRule("event-outputparams-must-have-description", (lint) => {
|
|
|
65
141
|
(0, import_vitest.expect)(results[0]?.path).toEqual(["events", EVENT_NAME, "schema", "properties", paramName, "description"]);
|
|
66
142
|
(0, import_vitest.expect)(results[0]?.message).toContain("description");
|
|
67
143
|
});
|
|
144
|
+
import_vitest.test.each(PARAM_NAMES)("empty description nested in anyOf should trigger (%s)", async (paramName) => {
|
|
145
|
+
const definition = {
|
|
146
|
+
events: {
|
|
147
|
+
[EVENT_NAME]: {
|
|
148
|
+
schema: {
|
|
149
|
+
properties: { [paramName]: { anyOf: [{ type: "object", description: EMPTY_STRING }, { type: "null" }] } }
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const results = await lint(definition);
|
|
155
|
+
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
156
|
+
(0, import_vitest.expect)(results[0]?.path).toEqual([
|
|
157
|
+
"events",
|
|
158
|
+
EVENT_NAME,
|
|
159
|
+
"schema",
|
|
160
|
+
"properties",
|
|
161
|
+
paramName,
|
|
162
|
+
"anyOf",
|
|
163
|
+
"0",
|
|
164
|
+
"description"
|
|
165
|
+
]);
|
|
166
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("description");
|
|
167
|
+
(0, import_vitest.expect)(results[0]?.message).toContain(paramName);
|
|
168
|
+
});
|
|
68
169
|
import_vitest.test.each(PARAM_NAMES)("valid description should not trigger (%s)", async (paramName) => {
|
|
69
170
|
const definition = {
|
|
70
171
|
events: {
|
|
@@ -74,6 +175,19 @@ describeRule("event-outputparams-must-have-description", (lint) => {
|
|
|
74
175
|
const results = await lint(definition);
|
|
75
176
|
(0, import_vitest.expect)(results).toHaveLength(0);
|
|
76
177
|
});
|
|
178
|
+
import_vitest.test.each(PARAM_NAMES)("valid description nested in anyOf should not trigger (%s)", async (paramName) => {
|
|
179
|
+
const definition = {
|
|
180
|
+
events: {
|
|
181
|
+
[EVENT_NAME]: {
|
|
182
|
+
schema: {
|
|
183
|
+
properties: { [paramName]: { anyOf: [{ type: "object", description: TRUTHY_STRING }, { type: "null" }] } }
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const results = await lint(definition);
|
|
189
|
+
(0, import_vitest.expect)(results).toHaveLength(0);
|
|
190
|
+
});
|
|
77
191
|
});
|
|
78
192
|
describeRule("configuration-fields-must-have-a-title", (lint) => {
|
|
79
193
|
import_vitest.test.each(PARAM_NAMES)("missing title should trigger (%s)", async (paramName) => {
|
|
@@ -85,6 +199,20 @@ describeRule("configuration-fields-must-have-a-title", (lint) => {
|
|
|
85
199
|
(0, import_vitest.expect)(results[0]?.path).toEqual(["configuration", "schema", "properties", paramName, ZUI]);
|
|
86
200
|
(0, import_vitest.expect)(results[0]?.message).toContain("title");
|
|
87
201
|
});
|
|
202
|
+
import_vitest.test.each(PARAM_NAMES)("missing title with anyOf should trigger (%s)", async (paramName) => {
|
|
203
|
+
const definition = {
|
|
204
|
+
configuration: {
|
|
205
|
+
schema: {
|
|
206
|
+
properties: { [paramName]: { anyOf: [{ type: "object", [ZUI]: {} }, { type: "null" }], [ZUI]: {} } }
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const results = await lint(definition);
|
|
211
|
+
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
212
|
+
(0, import_vitest.expect)(results[0]?.path).toEqual(["configuration", "schema", "properties", paramName, ZUI]);
|
|
213
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("title");
|
|
214
|
+
(0, import_vitest.expect)(results[0]?.message).toContain(paramName);
|
|
215
|
+
});
|
|
88
216
|
import_vitest.test.each(PARAM_NAMES)("empty title should trigger (%s)", async (paramName) => {
|
|
89
217
|
const definition = {
|
|
90
218
|
configuration: { schema: { properties: { [paramName]: { [ZUI]: { title: EMPTY_STRING } } } } }
|
|
@@ -94,6 +222,22 @@ describeRule("configuration-fields-must-have-a-title", (lint) => {
|
|
|
94
222
|
(0, import_vitest.expect)(results[0]?.path).toEqual(["configuration", "schema", "properties", paramName, ZUI, "title"]);
|
|
95
223
|
(0, import_vitest.expect)(results[0]?.message).toContain("title");
|
|
96
224
|
});
|
|
225
|
+
import_vitest.test.each(PARAM_NAMES)("empty title nested in anyOf should trigger (%s)", async (paramName) => {
|
|
226
|
+
const definition = {
|
|
227
|
+
configuration: {
|
|
228
|
+
schema: {
|
|
229
|
+
properties: {
|
|
230
|
+
[paramName]: { anyOf: [{ type: "object", [ZUI]: { title: EMPTY_STRING } }, { type: "null" }], [ZUI]: {} }
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
const results = await lint(definition);
|
|
236
|
+
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
237
|
+
(0, import_vitest.expect)(results[0]?.path).toEqual(["configuration", "schema", "properties", paramName, "anyOf", "0", ZUI, "title"]);
|
|
238
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("title");
|
|
239
|
+
(0, import_vitest.expect)(results[0]?.message).toContain(paramName);
|
|
240
|
+
});
|
|
97
241
|
import_vitest.test.each(PARAM_NAMES)("valid title should not trigger (%s)", async (paramName) => {
|
|
98
242
|
const definition = {
|
|
99
243
|
configuration: { schema: { properties: { [paramName]: { [ZUI]: { title: TRUTHY_STRING } } } } }
|
|
@@ -101,6 +245,19 @@ describeRule("configuration-fields-must-have-a-title", (lint) => {
|
|
|
101
245
|
const results = await lint(definition);
|
|
102
246
|
(0, import_vitest.expect)(results).toHaveLength(0);
|
|
103
247
|
});
|
|
248
|
+
import_vitest.test.each(PARAM_NAMES)("valid title nested in anyOf should not trigger (%s)", async (paramName) => {
|
|
249
|
+
const definition = {
|
|
250
|
+
configuration: {
|
|
251
|
+
schema: {
|
|
252
|
+
properties: {
|
|
253
|
+
[paramName]: { anyOf: [{ type: "object", [ZUI]: { title: TRUTHY_STRING } }, { type: "null" }], [ZUI]: {} }
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
const results = await lint(definition);
|
|
259
|
+
(0, import_vitest.expect)(results).toHaveLength(0);
|
|
260
|
+
});
|
|
104
261
|
});
|
|
105
262
|
describeRule("configuration-fields-must-have-a-description", (lint) => {
|
|
106
263
|
import_vitest.test.each(PARAM_NAMES)("missing description should trigger (%s)", async (paramName) => {
|
|
@@ -112,6 +269,22 @@ describeRule("configuration-fields-must-have-a-description", (lint) => {
|
|
|
112
269
|
(0, import_vitest.expect)(results[0]?.path).toEqual(["configuration", "schema", "properties", paramName]);
|
|
113
270
|
(0, import_vitest.expect)(results[0]?.message).toContain("description");
|
|
114
271
|
});
|
|
272
|
+
import_vitest.test.each(PARAM_NAMES)("missing description with anyOf should trigger (%s)", async (paramName) => {
|
|
273
|
+
const definition = {
|
|
274
|
+
configuration: {
|
|
275
|
+
schema: {
|
|
276
|
+
properties: {
|
|
277
|
+
[paramName]: { anyOf: [{ type: "object" }, { type: "null" }] }
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const results = await lint(definition);
|
|
283
|
+
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
284
|
+
(0, import_vitest.expect)(results[0]?.path).toEqual(["configuration", "schema", "properties", paramName]);
|
|
285
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("description");
|
|
286
|
+
(0, import_vitest.expect)(results[0]?.message).toContain(paramName);
|
|
287
|
+
});
|
|
115
288
|
import_vitest.test.each(PARAM_NAMES)("empty description should trigger (%s)", async (paramName) => {
|
|
116
289
|
const definition = {
|
|
117
290
|
configuration: { schema: { properties: { [paramName]: { description: EMPTY_STRING } } } }
|
|
@@ -121,6 +294,22 @@ describeRule("configuration-fields-must-have-a-description", (lint) => {
|
|
|
121
294
|
(0, import_vitest.expect)(results[0]?.path).toEqual(["configuration", "schema", "properties", paramName, "description"]);
|
|
122
295
|
(0, import_vitest.expect)(results[0]?.message).toContain("description");
|
|
123
296
|
});
|
|
297
|
+
import_vitest.test.each(PARAM_NAMES)("empty description nested in anyOf should trigger (%s)", async (paramName) => {
|
|
298
|
+
const definition = {
|
|
299
|
+
configuration: {
|
|
300
|
+
schema: {
|
|
301
|
+
properties: {
|
|
302
|
+
[paramName]: { anyOf: [{ type: "object", description: EMPTY_STRING }, { type: "null" }] }
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
const results = await lint(definition);
|
|
308
|
+
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
309
|
+
(0, import_vitest.expect)(results[0]?.path).toEqual(["configuration", "schema", "properties", paramName, "anyOf", "0", "description"]);
|
|
310
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("description");
|
|
311
|
+
(0, import_vitest.expect)(results[0]?.message).toContain(paramName);
|
|
312
|
+
});
|
|
124
313
|
import_vitest.test.each(PARAM_NAMES)("valid description should not trigger (%s)", async (paramName) => {
|
|
125
314
|
const definition = {
|
|
126
315
|
configuration: { schema: { properties: { [paramName]: { description: TRUTHY_STRING } } } }
|
|
@@ -128,6 +317,19 @@ describeRule("configuration-fields-must-have-a-description", (lint) => {
|
|
|
128
317
|
const results = await lint(definition);
|
|
129
318
|
(0, import_vitest.expect)(results).toHaveLength(0);
|
|
130
319
|
});
|
|
320
|
+
import_vitest.test.each(PARAM_NAMES)("valid description nested in anyOf should not trigger (%s)", async (paramName) => {
|
|
321
|
+
const definition = {
|
|
322
|
+
configuration: {
|
|
323
|
+
schema: {
|
|
324
|
+
properties: {
|
|
325
|
+
[paramName]: { anyOf: [{ type: "object", description: TRUTHY_STRING }, { type: "null" }] }
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
const results = await lint(definition);
|
|
331
|
+
(0, import_vitest.expect)(results).toHaveLength(0);
|
|
332
|
+
});
|
|
131
333
|
});
|
|
132
334
|
describeRule("user-tags-should-have-a-title", (lint) => {
|
|
133
335
|
(0, import_vitest.test)("missing title should trigger", async () => {
|
|
@@ -313,6 +515,23 @@ describeRule("state-fields-should-have-title", (lint) => {
|
|
|
313
515
|
const results = await lint(definition);
|
|
314
516
|
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
315
517
|
(0, import_vitest.expect)(results[0]?.path).toEqual(["states", STATE_NAME, "schema", "properties", paramName, ZUI]);
|
|
518
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("title");
|
|
519
|
+
});
|
|
520
|
+
import_vitest.test.each(PARAM_NAMES)("missing title with anyOf should trigger (%s)", async (paramName) => {
|
|
521
|
+
const definition = {
|
|
522
|
+
states: {
|
|
523
|
+
[STATE_NAME]: {
|
|
524
|
+
schema: {
|
|
525
|
+
properties: { [paramName]: { anyOf: [{ type: "object", [ZUI]: {} }, { type: "null" }], [ZUI]: {} } }
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
const results = await lint(definition);
|
|
531
|
+
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
532
|
+
(0, import_vitest.expect)(results[0]?.path).toEqual(["states", STATE_NAME, "schema", "properties", paramName, ZUI]);
|
|
533
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("title");
|
|
534
|
+
(0, import_vitest.expect)(results[0]?.message).toContain(paramName);
|
|
316
535
|
});
|
|
317
536
|
import_vitest.test.each(PARAM_NAMES)("empty title should trigger (%s)", async (paramName) => {
|
|
318
537
|
const definition = {
|
|
@@ -321,6 +540,35 @@ describeRule("state-fields-should-have-title", (lint) => {
|
|
|
321
540
|
const results = await lint(definition);
|
|
322
541
|
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
323
542
|
(0, import_vitest.expect)(results[0]?.path).toEqual(["states", STATE_NAME, "schema", "properties", paramName, ZUI, "title"]);
|
|
543
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("title");
|
|
544
|
+
});
|
|
545
|
+
import_vitest.test.each(PARAM_NAMES)("empty title nested in anyOf should trigger (%s)", async (paramName) => {
|
|
546
|
+
const definition = {
|
|
547
|
+
states: {
|
|
548
|
+
[STATE_NAME]: {
|
|
549
|
+
schema: {
|
|
550
|
+
properties: {
|
|
551
|
+
[paramName]: { anyOf: [{ type: "object", [ZUI]: { title: EMPTY_STRING } }, { type: "null" }], [ZUI]: {} }
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
const results = await lint(definition);
|
|
558
|
+
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
559
|
+
(0, import_vitest.expect)(results[0]?.path).toEqual([
|
|
560
|
+
"states",
|
|
561
|
+
STATE_NAME,
|
|
562
|
+
"schema",
|
|
563
|
+
"properties",
|
|
564
|
+
paramName,
|
|
565
|
+
"anyOf",
|
|
566
|
+
"0",
|
|
567
|
+
ZUI,
|
|
568
|
+
"title"
|
|
569
|
+
]);
|
|
570
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("title");
|
|
571
|
+
(0, import_vitest.expect)(results[0]?.message).toContain(paramName);
|
|
324
572
|
});
|
|
325
573
|
import_vitest.test.each(PARAM_NAMES)("valid title should not trigger (%s)", async (paramName) => {
|
|
326
574
|
const definition = {
|
|
@@ -329,6 +577,24 @@ describeRule("state-fields-should-have-title", (lint) => {
|
|
|
329
577
|
const results = await lint(definition);
|
|
330
578
|
(0, import_vitest.expect)(results).toHaveLength(0);
|
|
331
579
|
});
|
|
580
|
+
import_vitest.test.each(PARAM_NAMES)("valid title nested in anyOf should not trigger (%s)", async (paramName) => {
|
|
581
|
+
const definition = {
|
|
582
|
+
states: {
|
|
583
|
+
[STATE_NAME]: {
|
|
584
|
+
schema: {
|
|
585
|
+
properties: {
|
|
586
|
+
[paramName]: {
|
|
587
|
+
anyOf: [{ type: "object", [ZUI]: { title: TRUTHY_STRING } }, { type: "null" }],
|
|
588
|
+
[ZUI]: {}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
const results = await lint(definition);
|
|
596
|
+
(0, import_vitest.expect)(results).toHaveLength(0);
|
|
597
|
+
});
|
|
332
598
|
});
|
|
333
599
|
describeRule("state-fields-must-have-description", (lint) => {
|
|
334
600
|
import_vitest.test.each(PARAM_NAMES)("missing description should trigger (%s)", async (paramName) => {
|
|
@@ -338,6 +604,23 @@ describeRule("state-fields-must-have-description", (lint) => {
|
|
|
338
604
|
const results = await lint(definition);
|
|
339
605
|
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
340
606
|
(0, import_vitest.expect)(results[0]?.path).toEqual(["states", STATE_NAME, "schema", "properties", paramName]);
|
|
607
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("description");
|
|
608
|
+
});
|
|
609
|
+
import_vitest.test.each(PARAM_NAMES)("missing description with anyOf should trigger (%s)", async (paramName) => {
|
|
610
|
+
const definition = {
|
|
611
|
+
states: {
|
|
612
|
+
[STATE_NAME]: {
|
|
613
|
+
schema: {
|
|
614
|
+
properties: { [paramName]: { anyOf: [{ type: "object" }, { type: "null" }] } }
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
const results = await lint(definition);
|
|
620
|
+
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
621
|
+
(0, import_vitest.expect)(results[0]?.path).toEqual(["states", STATE_NAME, "schema", "properties", paramName]);
|
|
622
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("description");
|
|
623
|
+
(0, import_vitest.expect)(results[0]?.message).toContain(paramName);
|
|
341
624
|
});
|
|
342
625
|
import_vitest.test.each(PARAM_NAMES)("empty description should trigger (%s)", async (paramName) => {
|
|
343
626
|
const definition = {
|
|
@@ -346,6 +629,32 @@ describeRule("state-fields-must-have-description", (lint) => {
|
|
|
346
629
|
const results = await lint(definition);
|
|
347
630
|
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
348
631
|
(0, import_vitest.expect)(results[0]?.path).toEqual(["states", STATE_NAME, "schema", "properties", paramName, "description"]);
|
|
632
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("description");
|
|
633
|
+
});
|
|
634
|
+
import_vitest.test.each(PARAM_NAMES)("empty description nested in anyOf should trigger (%s)", async (paramName) => {
|
|
635
|
+
const definition = {
|
|
636
|
+
states: {
|
|
637
|
+
[STATE_NAME]: {
|
|
638
|
+
schema: {
|
|
639
|
+
properties: { [paramName]: { anyOf: [{ type: "object", description: EMPTY_STRING }, { type: "null" }] } }
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
const results = await lint(definition);
|
|
645
|
+
(0, import_vitest.expect)(results).toHaveLength(1);
|
|
646
|
+
(0, import_vitest.expect)(results[0]?.path).toEqual([
|
|
647
|
+
"states",
|
|
648
|
+
STATE_NAME,
|
|
649
|
+
"schema",
|
|
650
|
+
"properties",
|
|
651
|
+
paramName,
|
|
652
|
+
"anyOf",
|
|
653
|
+
"0",
|
|
654
|
+
"description"
|
|
655
|
+
]);
|
|
656
|
+
(0, import_vitest.expect)(results[0]?.message).toContain("description");
|
|
657
|
+
(0, import_vitest.expect)(results[0]?.message).toContain(paramName);
|
|
349
658
|
});
|
|
350
659
|
import_vitest.test.each(PARAM_NAMES)("valid description should not trigger (%s)", async (paramName) => {
|
|
351
660
|
const definition = {
|
|
@@ -354,5 +663,18 @@ describeRule("state-fields-must-have-description", (lint) => {
|
|
|
354
663
|
const results = await lint(definition);
|
|
355
664
|
(0, import_vitest.expect)(results).toHaveLength(0);
|
|
356
665
|
});
|
|
666
|
+
import_vitest.test.each(PARAM_NAMES)("valid description nested in anyOf should not trigger (%s)", async (paramName) => {
|
|
667
|
+
const definition = {
|
|
668
|
+
states: {
|
|
669
|
+
[STATE_NAME]: {
|
|
670
|
+
schema: {
|
|
671
|
+
properties: { [paramName]: { anyOf: [{ type: "object", description: TRUTHY_STRING }, { type: "null" }] } }
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
const results = await lint(definition);
|
|
677
|
+
(0, import_vitest.expect)(results).toHaveLength(0);
|
|
678
|
+
});
|
|
357
679
|
});
|
|
358
680
|
//# sourceMappingURL=bot.ruleset.test.js.map
|