use crate::snippets::error::Result;
use crate::snippets::types::{Language, Snippet, SnippetStatus, ValidationLevel};
use crate::snippets::validators::SnippetValidator;
macro_rules! documentation_validator {
($name:ident, $lang:ident) => {
pub struct $name;
impl SnippetValidator for $name {
fn language(&self) -> Language {
Language::$lang
}
fn is_available(&self) -> bool {
true
}
fn validate(
&self,
_snippet: &Snippet,
_level: ValidationLevel,
_timeout_secs: u64,
) -> Result<(SnippetStatus, Option<String>)> {
Ok((SnippetStatus::Pass, None))
}
fn max_level(&self) -> ValidationLevel {
ValidationLevel::Syntax
}
}
};
}
documentation_validator!(TextValidator, Text);
documentation_validator!(MermaidValidator, Mermaid);
documentation_validator!(PowerShellValidator, PowerShell);
documentation_validator!(XmlValidator, Xml);
documentation_validator!(DockerValidator, Docker);