use serde::Deserialize;
#[derive(Clone, Debug, Deserialize)]
pub struct FileTreeViewConfig {
#[serde(default)]
pub show_hidden: bool,
#[serde(default = "default_true")]
pub builtin_excludes: bool,
#[serde(default)]
pub extra_excludes: Vec<String>,
#[serde(default)]
pub include: Vec<String>,
}
fn default_true() -> bool {
true
}
impl Default for FileTreeViewConfig {
fn default() -> Self {
Self {
show_hidden: false,
builtin_excludes: true,
extra_excludes: Vec::new(),
include: Vec::new(),
}
}
}
impl FileTreeViewConfig {
pub fn to_filter(&self) -> apimock_routing::view::build::FileTreeFilter {
apimock_routing::view::build::FileTreeFilter {
show_hidden: self.show_hidden,
builtin_excludes: self.builtin_excludes,
extra_excludes: self.extra_excludes.clone(),
include: self.include.clone(),
}
}
}