MCPcopy Create free account
hub / github.com/PowerShell/DSC / validate_parameters

Function validate_parameters

lib/dsc-lib/src/functions/user_function.rs:48–58  ·  view source on GitHub ↗
(name: &str, function_definition: &UserFunctionDefinition, args: &[Value])

Source from the content-addressed store, hash-verified

46}
47
48fn validate_parameters(name: &str, function_definition: &UserFunctionDefinition, args: &[Value]) -> Result<(), DscError> {
49 if let Some(expected_params) = &function_definition.parameters {
50 if args.len() != expected_params.len() {
51 return Err(DscError::Parser(t!("functions.userFunction.wrongParamCount", name = name, expected = expected_params.len(), got = args.len()).to_string()));
52 }
53 for (arg, expected_param) in args.iter().zip(expected_params) {
54 validate_parameter_type(name, arg, &expected_param.r#type)?;
55 }
56 }
57 Ok(())
58}
59
60fn validate_output_type(name: &str, function_definition: &UserFunctionDefinition, output: &Value) -> Result<(), DscError> {
61 match function_definition.output.r#type {

Callers 1

invoke_user_functionFunction · 0.85

Calls 1

validate_parameter_typeFunction · 0.85

Tested by

no test coverage detected