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("IO error: {0}")]
50    IoError(String),
51    #[error("Export error: {0}")]
52    ExportError(String),
53    #[error("BPMN export error: {0}")]
54    BPMNExportError(String),
55    #[error("DMN export error: {0}")]
56    DMNExportError(String),
57    #[error("OpenAPI export error: {0}")]
58    OpenAPIExportError(String),
59    #[error("Model not found: {0}")]
60    ModelNotFound(String),
61}
62
63impl From<Box<dyn std::error::Error>> for ExportError {
64    fn from(err: Box<dyn std::error::Error>) -> Self {
65        ExportError::ExportError(err.to_string())
66    }
67}
68
69// Re-export for convenience
70pub use avro::AvroExporter;
71#[cfg(feature = "bpmn")]
72pub use bpmn::BPMNExporter;
73pub use cads::CADSExporter;
74#[cfg(feature = "dmn")]
75pub use dmn::DMNExporter;
76pub use json_schema::JSONSchemaExporter;
77pub use odcl::ODCLExporter;
78pub use odcs::ODCSExporter;
79pub use odps::ODPSExporter;
80#[cfg(feature = "openapi")]
81pub use openapi::OpenAPIExporter;
82#[cfg(feature = "png-export")]
83pub use png::PNGExporter;
84pub use protobuf::ProtobufExporter;
85pub use sql::SQLExporter;