Orchestrator Function: Validate Function Inputs

by Simon Sparks · 4 February 2026

To use this function add it to the class library file named Utilities.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: Utilities.ts

Function: validateFunctionInputs

publicstaticvalidateFunctionInputs(inputProperties:Properties,strResourceActionType:string,strResourceActionName:string,objWorkflowToken:WorkflowToken):void{
letstrWorkflowName:string=`${strResourceActionType} -${strResourceActionName}`;

letobjLogger:Logger=Logger.getLogger(`${strWorkflowName} - validateFunctionInputs`);

letobjProperties:Properties=objWorkflowToken.getInputParameters();

letobjWorkflow:Workflow=objWorkflowToken.currentWorkflow;

letarrParameter:Parameter[]=objWorkflow.inParameters;

arrParameter.forEach((objParameter:Parameter):void=>{

objLogger.info(`Input Parameter:${objParameter.name}:${objParameter.type} (${objParameter.description} ).`);

letobjValue:any=objProperties.get(objParameter.name);

letstrType:string=System.getObjectType(objValue);

strType=strType.toLowerCase();

if (strType==="string"&&objValue===null){
thrownewError_RequiredParameter_Null(objParameter.name);

}elseif (strType==="string"&&objValue===""){
thrownewError_RequiredParameter_EmptyString(objParameter.name);

}elseif (strType==="number"&&objValue===null){
thrownewError_RequiredParameter_Null(objParameter.name);

}elseif (strType==="number"&&Number.isNaN(objValue)){
thrownewError_RequiredParameter_NotANumber(objParameter.name);

}elseif (strType==="boolean"&&objValue===null){
thrownewError_RequiredParameter_Null(objParameter.name);

}elseif (strType==="boolean"&& (objValue!==true||objValue!==false)){
thrownewError_RequiredParameter_NotTrueOrFalse(objParameter.name);

}elseif (strType==="date"&&objValue===null){
thrownewError_RequiredParameter_Null(objParameter.name);

}elseif (strType==="date"&&!(objValueinstanceofDate)){
thrownewError_RequiredParameter_NotADate(objParameter.name);

}elseif (strType==="array"&&objValue===null){
thrownewError_RequiredParameter_Null(objParameter.name);

}elseif (strType==="array"&&objValue.length===0){
thrownewError_RequiredParameter_EmptyArray(objParameter.name);

}elseif (strType==="array"&&Array.isArray(objValue)===false){
thrownewError_RequiredParameter_NotAnArray(objParameter.name);

}elseif (strType==="object"&&objValue===null){
thrownewError_RequiredParameter_Null(objParameter.name);

}elseif (strType==="object"&&objValueinstanceofeval(strType)){
thrownewError_RequiredParameter_Missing(objParameter.name);
}
});
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like