rest-server: bump schema to 1.2 and use convenience methods
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
fd7f760304
commit
5b93835744
@ -7,7 +7,7 @@ description = "REST server implementation"
|
||||
|
||||
# for example
|
||||
[dev-dependencies]
|
||||
proxmox-schema = { version = "1.1", features = [ "api-macro" ] }
|
||||
proxmox-schema = { version = "1.2", features = [ "api-macro" ] }
|
||||
tokio = { version = "1.6", features = [ "rt-multi-thread", "signal", "process" ] }
|
||||
|
||||
[dependencies]
|
||||
@ -36,6 +36,6 @@ proxmox-io = "1"
|
||||
proxmox-lang = "1"
|
||||
proxmox-http = { version = "0.6", features = [ "client" ] }
|
||||
proxmox-router = "1.1"
|
||||
proxmox-schema = { version = "1.1", features = [ "api-macro", "upid-api-impl" ] }
|
||||
proxmox-schema = { version = "1.2", features = [ "api-macro", "upid-api-impl" ] }
|
||||
proxmox-time = "1"
|
||||
proxmox-sys = "0.2"
|
||||
|
@ -147,13 +147,14 @@ impl OutputFormatter for ExtJsFormatter {
|
||||
let message: String;
|
||||
let mut errors = HashMap::new();
|
||||
|
||||
if let Some(param_err) = err.downcast_ref::<ParameterError>() {
|
||||
for (name, err) in param_err.errors().iter() {
|
||||
errors.insert(name, err.to_string());
|
||||
match err.downcast::<ParameterError>() {
|
||||
Ok(param_err) => {
|
||||
for (name, err) in param_err {
|
||||
errors.insert(name, err.to_string());
|
||||
}
|
||||
message = String::from("parameter verification errors");
|
||||
}
|
||||
message = String::from("parameter verification errors");
|
||||
} else {
|
||||
message = err.to_string();
|
||||
Err(err) => message = err.to_string(),
|
||||
}
|
||||
|
||||
let result = json!({
|
||||
|
Loading…
Reference in New Issue
Block a user