pub struct ODCLImporter { /* private fields */ }Expand description
ODCL parser service for parsing legacy Open Data Contract Language YAML files. Handles Data Contract Specification format and simple ODCL format.
For ODCS v3.1.0 format, use ODCSImporter instead.
Implementations§
Source§impl ODCLImporter
impl ODCLImporter
Sourcepub fn new() -> ODCLImporter
pub fn new() -> ODCLImporter
Create a new ODCL parser instance.
§Example
use data_modelling_core::import::odcl::ODCLImporter;
let mut importer = ODCLImporter::new();Sourcepub fn import(
&mut self,
yaml_content: &str,
) -> Result<ImportResult, ImportError>
pub fn import( &mut self, yaml_content: &str, ) -> Result<ImportResult, ImportError>
Import ODCL YAML content and create Table (SDK interface).
Supports Data Contract Specification format and simple ODCL format.
§Arguments
yaml_content- ODCL YAML content as a string
§Returns
An ImportResult containing the extracted table and any parse errors.
§Example
use data_modelling_core::import::odcl::ODCLImporter;
let mut importer = ODCLImporter::new();
let yaml = r#"
dataContractSpecification: 0.9.3
id: urn:datacontract:example
models:
users:
fields:
id:
type: bigint
"#;
let result = importer.import(yaml).unwrap();
assert_eq!(result.tables.len(), 1);Sourcepub fn parse_table(
&mut self,
yaml_content: &str,
) -> Result<(Table, Vec<ParserError>), Error>
pub fn parse_table( &mut self, yaml_content: &str, ) -> Result<(Table, Vec<ParserError>), Error>
Parse ODCL YAML content and create Table (public method for native app use).
This method returns the full Table object with all metadata, suitable for use in
native applications that need direct access to the parsed table structure.
For API use, prefer the import() method which returns ImportResult.
§Returns
Returns a tuple of (Table, list of errors/warnings). Errors list is empty if parsing is successful.
Sourcepub fn can_handle(&self, yaml_content: &str) -> bool
pub fn can_handle(&self, yaml_content: &str) -> bool
Check if this importer can handle the given YAML content.
Returns true if the content is in ODCL format (Data Contract Specification or simple ODCL format), false if it’s in ODCS v3.x format.