harn_cli/package/manifest/
check_config.rs1use std::collections::HashMap;
2
3use serde::Deserialize;
4
5#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
11pub enum PreflightSeverity {
12 #[default]
13 Error,
14 Warning,
15 Off,
16}
17
18impl PreflightSeverity {
19 pub fn from_opt(raw: Option<&str>) -> Self {
20 match raw.map(|s| s.to_ascii_lowercase()) {
21 Some(v) if v == "warning" || v == "warn" => Self::Warning,
22 Some(v) if v == "off" || v == "allow" || v == "silent" => Self::Off,
23 _ => Self::Error,
24 }
25 }
26}
27
28#[derive(Debug, Default, Clone, Deserialize)]
29pub struct CheckConfig {
30 #[serde(default)]
31 pub strict: bool,
32 #[serde(default)]
33 pub strict_types: bool,
34 #[serde(default)]
37 pub trusted_host_dispatch: bool,
38 #[serde(default)]
39 pub disable_rules: Vec<String>,
40 #[serde(default)]
41 pub host_capabilities: HashMap<String, Vec<String>>,
42 #[serde(default, alias = "host_capabilities_file")]
43 pub host_capabilities_path: Option<String>,
44 #[serde(default)]
45 pub bundle_root: Option<String>,
46 #[serde(default, alias = "preflight-severity")]
49 pub preflight_severity: Option<String>,
50 #[serde(default, alias = "preflight-allow")]
54 pub preflight_allow: Vec<String>,
55}