use schemars::JsonSchema;
use serde::Deserialize;
#[derive(Debug, Deserialize, JsonSchema)]
pub struct ScreenshotParams {
#[serde(alias = "window", alias = "webview_label")]
pub window_label: Option<String>,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn screenshot_accepts_window_aliases() {
for key in ["window_label", "window", "webview_label"] {
let json = format!(r#"{{"{key}":"briefing"}}"#);
let p: ScreenshotParams = serde_json::from_str(&json).unwrap();
assert_eq!(
p.window_label.as_deref(),
Some("briefing"),
"key `{key}` must target the window"
);
}
}
}