api-macro: update tests, cleanup some macro generated paths

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-11-27 14:46:20 +01:00
parent 0bf354e437
commit 993eb7d168
2 changed files with 6 additions and 4 deletions

View File

@ -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");
}

View File

@ -79,8 +79,10 @@ fn create_ticket(_param: Value) -> Result<Value, Error> {
/// Create or verify authentication ticket.
///
/// Returns: A ticket.
fn create_ticket_direct(username: String, password: String) -> Result<Value, Error> {
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")
}