Skip to main content

ontocore_plugin/
traits.rs

1use ontocore_catalog::OntologyCatalog;
2use ontocore_core::Diagnostic;
3use ontocore_docs::{ExportError, ExportOptions};
4use std::path::{Path, PathBuf};
5
6pub trait ValidatorPlugin: Send + Sync {
7    fn id(&self) -> &str;
8    fn validate(&self, catalog: &OntologyCatalog, workspace: &Path) -> Vec<Diagnostic>;
9}
10
11pub trait ExporterPlugin: Send + Sync {
12    fn id(&self) -> &str;
13    fn export(
14        &self,
15        catalog: &OntologyCatalog,
16        workspace: &Path,
17        options: ExportOptions,
18    ) -> Result<Vec<PathBuf>, ExportError>;
19}
20
21#[derive(Debug, Clone)]
22pub struct WorkflowRequest {
23    pub step: String,
24    pub dry_run: bool,
25}
26
27#[derive(Debug, Clone)]
28pub struct WorkflowResult {
29    pub success: bool,
30    pub logs: String,
31    pub diagnostics: Vec<Diagnostic>,
32}
33
34pub trait WorkflowPlugin: Send + Sync {
35    fn id(&self) -> &str;
36    fn run(&self, workspace: &Path, request: WorkflowRequest) -> WorkflowResult;
37}