fixed nested function in workflow validator
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import { Action } from "../../declarations/Action";
|
import { Action } from "../../declarations/Action";
|
||||||
import { getOperatorByName } from "./getOperatorByName";
|
import { getOperatorByName } from "./getOperatorByName";
|
||||||
|
|
||||||
|
/** This function validates the "workflow-json" from the API */
|
||||||
export function validateOperations(actions: Action[]): { valid: boolean, reason?: string} {
|
export function validateOperations(actions: Action[]): { valid: boolean, reason?: string} {
|
||||||
function validateOperation(actions: Action[]): { valid: boolean; reason?: string; } {
|
|
||||||
for (const action of actions) {
|
for (const action of actions) {
|
||||||
if (action.type === "wait" || action.type === "done") {
|
if (action.type === "wait" || action.type === "done") {
|
||||||
// TODO: Validate these too ):
|
// TODO: Validate these too ):
|
||||||
@@ -21,7 +21,7 @@ export function validateOperations(actions: Action[]): { valid: boolean, reason?
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (action.actions) {
|
if (action.actions) {
|
||||||
const validationResult = validateOperation(action.actions);
|
const validationResult = validateOperations(action.actions);
|
||||||
|
|
||||||
if(!validationResult.valid) {
|
if(!validationResult.valid) {
|
||||||
return validationResult;
|
return validationResult;
|
||||||
@@ -30,6 +30,3 @@ export function validateOperations(actions: Action[]): { valid: boolean, reason?
|
|||||||
}
|
}
|
||||||
return { valid: true };
|
return { valid: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
return validateOperation(actions);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user