data_modelling_sdk/export/
mod.rs

1//! Export functionality
2//!
3//! Provides exporters for various formats:
4//! - SQL
5//! - JSON Schema
6//! - AVRO
7//! - Protobuf
8//! - ODCS (Open Data Contract Standard) v3.1.0
9//! - PNG
10
11pub mod avro;
12#[cfg(feature = "bpmn")]
13pub mod bpmn;
14pub mod cads;
15#[cfg(feature = "dmn")]
16pub mod dmn;
17pub mod json_schema;
18pub mod odcl;
19pub mod odcs;
20pub mod odps;
21#[cfg(feature = "openapi")]
22pub mod openapi;
23#[cfg(feature = "png-export")]
24pub mod png;
25pub mod protobuf;
26pub mod sql;
27
28// anyhow::Result not currently used in this module
29
30/// Result of an export operation.
31///
32/// Contains the exported content and format identifier.
33#[derive(Debug, serde::Serialize, serde::Deserialize)]
34#[must_use = "export results contain the exported content and should be used"]
35pub struct ExportResult {
36    /// Exported content (as string - binary formats will be base64 encoded)
37    pub content: String,
38    /// Format identifier
39    pub format: String,
40}
41
42/// Error during export
43#[derive(Debug, thiserror::Error, serde::Serialize, serde::Deserialize)]
44pub enum ExportError {
45    #[error("Serialization error: {0}")]
46    SerializationError(String),
47    #[error("Validation error: {0}")]
48    ValidationError(String),
49    #[error("Invalid argument: {0}")]
50    InvalidArgument(String),
51    #[error("IO error: {0}")]
52    IoError(String),
53    #[error("Export error: {0}")]
54    ExportError(String),
55    #[error("BPMN export error: {0}")]
56    BPMNExportError(String),
57    #[error("DMN export error: {0}")]
58    DMNExportError(String),
59    #[error("OpenAPI export error: {0}")]
60    OpenAPIExportError(String),
61    #[error("Model not found: {0}")]
62    ModelNotFound(String),
63}
64
65impl From<Box<dyn std::error::Error>> for ExportError {
66    fn from(err: Box<dyn std::error::Error>) -> Self {
67        ExportError::ExportError(err.to_string())
68    }
69}
70
71// Re-export for convenience
72pub use avro::AvroExporter;
73#[cfg(feature = "bpmn")]
74pub use bpmn::BPMNExporter;
75pub use cads::CADSExporter;
76#[cfg(feature = "dmn")]
77pub use dmn::DMNExporter;
78pub use json_schema::JSONSchemaExporter;
79pub use odcl::ODCLExporter;
80pub use odcs::ODCSExporter;
81pub use odps::ODPSExporter;
82#[cfg(feature = "openapi")]
83pub use openapi::OpenAPIExporter;
84#[cfg(feature = "png-export")]
85pub use png::PNGExporter;
86pub use protobuf::ProtobufExporter;
87pub use sql::SQLExporter;