data_modelling_sdk/import/
mod.rs1pub mod avro;
11#[cfg(feature = "bpmn")]
12pub mod bpmn;
13pub mod cads;
14#[cfg(feature = "dmn")]
15pub mod dmn;
16pub mod json_schema;
17pub mod odcs;
18pub mod odps;
19#[cfg(feature = "openapi")]
20pub mod openapi;
21pub mod protobuf;
22pub mod sql;
23
24#[derive(Debug, serde::Serialize, serde::Deserialize)]
30#[must_use = "import results should be processed or errors checked"]
31pub struct ImportResult {
32 pub tables: Vec<TableData>,
34 pub tables_requiring_name: Vec<TableRequiringName>,
36 pub errors: Vec<ImportError>,
38 pub ai_suggestions: Option<Vec<serde_json::Value>>,
40}
41
42#[derive(Debug, thiserror::Error, serde::Serialize, serde::Deserialize)]
44pub enum ImportError {
45 #[error("Parse error: {0}")]
46 ParseError(String),
47 #[error("Validation error: {0}")]
48 ValidationError(String),
49 #[error("IO error: {0}")]
50 IoError(String),
51 #[error("BPMN validation error: {0}")]
52 BPMNValidationError(String),
53 #[error("DMN validation error: {0}")]
54 DMNValidationError(String),
55 #[error("OpenAPI validation error: {0}")]
56 OpenAPIValidationError(String),
57 #[error("BPMN parse error: {0}")]
58 BPMNParseError(String),
59 #[error("DMN parse error: {0}")]
60 DMNParseError(String),
61 #[error("OpenAPI parse error: {0}")]
62 OpenAPIParseError(String),
63}
64
65#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
67pub struct TableData {
68 pub table_index: usize,
69 pub name: Option<String>,
70 pub columns: Vec<ColumnData>,
71 }
73
74#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
76pub struct ColumnData {
77 pub name: String,
78 pub data_type: String,
79 pub nullable: bool,
80 pub primary_key: bool,
81 #[serde(skip_serializing_if = "Option::is_none")]
83 pub description: Option<String>,
84 #[serde(skip_serializing_if = "Option::is_none")]
86 pub quality: Option<Vec<std::collections::HashMap<String, serde_json::Value>>>,
87 #[serde(skip_serializing_if = "Option::is_none", rename = "$ref")]
89 pub ref_path: Option<String>,
90}
91
92pub use avro::AvroImporter;
94pub use cads::CADSImporter;
95pub use json_schema::JSONSchemaImporter;
96pub use odcs::ODCSImporter;
97pub use odps::ODPSImporter;
98pub use protobuf::ProtobufImporter;
99pub use sql::SQLImporter;
100
101#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
103pub struct TableRequiringName {
104 pub table_index: usize,
105 pub suggested_name: Option<String>,
106}