@onlineapps/cookbook-core 2.1.4 → 2.1.7
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/package.json +1 -3
- package/schemas/cookbook.schema.json +211 -74
- package/schemas/cookbook.v2.schema.json +519 -136
- package/src/parser/cookbookValidatorV2.js +24 -19
|
@@ -249,48 +249,53 @@ function validateSemantics(cookbook, version) {
|
|
|
249
249
|
stepIds.add(stepId);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
// Check nested steps
|
|
253
|
-
if (step.steps
|
|
254
|
-
|
|
255
|
-
checkStep(nested, `${path}.steps
|
|
252
|
+
// Check nested steps
|
|
253
|
+
if (step.steps) {
|
|
254
|
+
step.steps.forEach((nested, idx) =>
|
|
255
|
+
checkStep(nested, `${path}.steps[${idx}]`)
|
|
256
256
|
);
|
|
257
257
|
}
|
|
258
|
-
if (step.body
|
|
259
|
-
|
|
260
|
-
checkStep(nested, `${path}.body
|
|
258
|
+
if (step.body) {
|
|
259
|
+
step.body.forEach((nested, idx) =>
|
|
260
|
+
checkStep(nested, `${path}.body[${idx}]`)
|
|
261
261
|
);
|
|
262
262
|
}
|
|
263
|
-
if (step.branches
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
if (step.branches) {
|
|
264
|
+
step.branches.forEach((branch, idx) => {
|
|
265
|
+
if (branch.steps) {
|
|
266
|
+
branch.steps.forEach((nested, jdx) =>
|
|
267
|
+
checkStep(nested, `${path}.branches[${idx}].steps[${jdx}]`)
|
|
268
|
+
);
|
|
269
|
+
}
|
|
266
270
|
});
|
|
267
271
|
}
|
|
268
272
|
if (step.cases) {
|
|
269
273
|
Object.keys(step.cases).forEach(caseKey => {
|
|
270
274
|
const caseVal = step.cases[caseKey];
|
|
271
|
-
|
|
275
|
+
if (caseVal.steps) {
|
|
276
|
+
caseVal.steps.forEach((nested, idx) =>
|
|
277
|
+
checkStep(nested, `${path}.cases.${caseKey}.steps[${idx}]`)
|
|
278
|
+
);
|
|
279
|
+
}
|
|
272
280
|
});
|
|
273
281
|
}
|
|
274
282
|
}
|
|
275
283
|
|
|
276
|
-
// Check all steps
|
|
284
|
+
// Check all steps
|
|
277
285
|
if (cookbook.steps) {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
Object.entries(cookbook.steps).forEach(([stepKey, step]) =>
|
|
282
|
-
checkStep(step, `steps.${stepKey}`)
|
|
286
|
+
cookbook.steps.forEach((step, idx) =>
|
|
287
|
+
checkStep(step, `steps[${idx}]`)
|
|
283
288
|
);
|
|
284
289
|
}
|
|
285
290
|
|
|
286
291
|
// Check dependencies exist
|
|
287
292
|
if (version === '2.0' && cookbook.steps) {
|
|
288
|
-
|
|
293
|
+
cookbook.steps.forEach((step, idx) => {
|
|
289
294
|
if (step.depends_on) {
|
|
290
295
|
step.depends_on.forEach(dep => {
|
|
291
296
|
if (!stepIds.has(dep)) {
|
|
292
297
|
throw new CookbookValidationError(
|
|
293
|
-
`Step
|
|
298
|
+
`Step ${idx} depends on non-existent step_id '${dep}'`
|
|
294
299
|
);
|
|
295
300
|
}
|
|
296
301
|
});
|