mod other_crate {
pub struct Duration {
pub secs: i64,
pub nanos: i32,
}
}
use other_crate::Duration;
use schemars::{schema_for, JsonSchema};
#[derive(JsonSchema)]
#[serde(remote = "Duration")]
pub struct DurationDef {
pub secs: i64,
pub nanos: i32,
}
#[derive(JsonSchema)]
pub struct Process {
pub command_line: String,
#[serde(with = "DurationDef")]
pub wall_time: Duration,
#[serde(with = "Vec::<DurationDef>")]
pub durations: Vec<Duration>,
}
fn main() {
let schema = schema_for!(Process);
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
}