diff --git a/proxmox-api-macro/src/api.rs b/proxmox-api-macro/src/api.rs index b71f3406..b12635c3 100644 --- a/proxmox-api-macro/src/api.rs +++ b/proxmox-api-macro/src/api.rs @@ -646,9 +646,9 @@ fn create_wrapper_function( api_method_param: &::proxmox::api::ApiMethod, rpc_env_param: &mut dyn ::proxmox::api::RpcEnvironment, ) -> Result<::serde_json::Value, ::failure::Error> { - if let Value::Object(ref mut input_map) = &mut input_params { + if let ::serde_json::Value::Object(ref mut input_map) = &mut input_params { #body - Ok(serde_json::to_value(#func_name(#args)?)?) + Ok(::serde_json::to_value(#func_name(#args)?)?) } else { ::failure::bail!("api function wrapper called with a non-object json value"); } diff --git a/proxmox-api-macro/tests/api1.rs b/proxmox-api-macro/tests/api1.rs index 428f28c1..f7943b23 100644 --- a/proxmox-api-macro/tests/api1.rs +++ b/proxmox-api-macro/tests/api1.rs @@ -79,8 +79,10 @@ fn create_ticket(_param: Value) -> Result { /// Create or verify authentication ticket. /// /// Returns: A ticket. -fn create_ticket_direct(username: String, password: String) -> Result { +fn create_ticket_direct(username: String, password: String) -> Result<&'static str, Error> { let _ = username; let _ = password; - panic!("implement me"); + // This sill not pass the schema's output validation, but the code still compiles as this can + // successfully produce a `serde_json::Value`! + Ok("an:invalid:ticket") }