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 odcl;
18pub mod odcs;
19pub mod odcs_shared;
20pub mod odps;
21#[cfg(feature = "openapi")]
22pub mod openapi;
23pub mod protobuf;
24pub mod sql;
25
26#[derive(Debug, serde::Serialize, serde::Deserialize)]
32#[must_use = "import results should be processed or errors checked"]
33pub struct ImportResult {
34 pub tables: Vec<TableData>,
36 pub tables_requiring_name: Vec<TableRequiringName>,
38 pub errors: Vec<ImportError>,
40 pub ai_suggestions: Option<Vec<serde_json::Value>>,
42}
43
44#[derive(Debug, thiserror::Error, serde::Serialize, serde::Deserialize)]
46pub enum ImportError {
47 #[error("Parse error: {0}")]
48 ParseError(String),
49 #[error("Validation error: {0}")]
50 ValidationError(String),
51 #[error("IO error: {0}")]
52 IoError(String),
53 #[error("BPMN validation error: {0}")]
54 BPMNValidationError(String),
55 #[error("DMN validation error: {0}")]
56 DMNValidationError(String),
57 #[error("OpenAPI validation error: {0}")]
58 OpenAPIValidationError(String),
59 #[error("BPMN parse error: {0}")]
60 BPMNParseError(String),
61 #[error("DMN parse error: {0}")]
62 DMNParseError(String),
63 #[error("OpenAPI parse error: {0}")]
64 OpenAPIParseError(String),
65}
66
67#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
69pub struct TableData {
70 pub table_index: usize,
71 pub name: Option<String>,
72 pub columns: Vec<ColumnData>,
73 }
75
76#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
78pub struct ColumnData {
79 pub name: String,
80 pub data_type: String,
81 #[serde(skip_serializing_if = "Option::is_none")]
84 pub physical_type: Option<String>,
85 pub nullable: bool,
86 pub primary_key: bool,
87 #[serde(skip_serializing_if = "Option::is_none")]
89 pub description: Option<String>,
90 #[serde(skip_serializing_if = "Option::is_none")]
92 pub quality: Option<Vec<std::collections::HashMap<String, serde_json::Value>>>,
93 #[serde(default, skip_serializing_if = "Vec::is_empty")]
96 pub relationships: Vec<crate::models::PropertyRelationship>,
97 #[serde(skip_serializing_if = "Option::is_none")]
99 pub enum_values: Option<Vec<String>>,
100}
101
102pub use avro::AvroImporter;
104pub use cads::CADSImporter;
105pub use json_schema::JSONSchemaImporter;
106pub use odcl::ODCLImporter;
107pub use odcs::ODCSImporter;
108pub use odcs_shared::ParserError;
109pub use odps::ODPSImporter;
110pub use protobuf::ProtobufImporter;
111pub use sql::SQLImporter;
112
113#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
115pub struct TableRequiringName {
116 pub table_index: usize,
117 pub suggested_name: Option<String>,
118}