# Data Modelling SDK

## Overview

The Data Modelling SDK is a Rust library that provides unified interfaces for data modeling operations across multiple platforms (native apps, WASM/web apps, and API backends). It enables importing from various formats (SQL, ODCS, JSON Schema, AVRO, Protobuf, CADS, ODPS, BPMN, DMN, OpenAPI), exporting to multiple formats, model validation, and storage abstraction for different environments.

**Repository**: https://github.com/pixie79/data-modelling-sdk
**License**: MIT
**Rust Edition**: 2024
**Version**: 1.6.0

## Architecture

The SDK is designed with a modular architecture centered around:

1. **Storage Backends**: Abstract storage operations (file system, browser storage, HTTP API)
2. **Models**: Core data structures (Table, Column, Relationship, DataModel)
3. **Import/Export**: Format converters for various data contract formats
4. **Validation**: Table and relationship validation logic
5. **Model Management**: Loading and saving models from storage backends

## Directory Structure

```
data-modelling-sdk/
├── src/
│   ├── lib.rs                 # Main library entry point, re-exports public API
│   ├── auth/                   # Authentication types (OAuth, session management)
│   │   └── mod.rs
│   ├── export/                 # Export functionality
│   │   ├── mod.rs
│   │   ├── avro.rs            # AVRO format exporter
│   │   ├── bpmn.rs            # BPMN 2.0 exporter (feature-gated)
│   │   ├── cads.rs            # CADS format exporter
│   │   ├── dmn.rs             # DMN 1.3 exporter (feature-gated)
│   │   ├── json_schema.rs     # JSON Schema exporter
│   │   ├── odcl.rs            # ODCL format exporter
│   │   ├── odcs.rs            # ODCS v3.1.0 format exporter
│   │   ├── odps.rs            # ODPS format exporter
│   │   ├── openapi.rs         # OpenAPI 3.1.1 exporter (feature-gated)
│   │   ├── png.rs             # PNG diagram exporter (feature-gated)
│   │   ├── protobuf.rs        # Protobuf exporter
│   │   └── sql.rs             # SQL DDL exporter
│   ├── convert/                # Universal format converter
│   │   ├── mod.rs
│   │   ├── converter.rs      # Universal converter (any format → ODCS)
│   │   ├── migrate_dataflow.rs # DataFlow → Domain migration utility
│   │   └── openapi_to_odcs.rs # OpenAPI to ODCS converter (feature-gated)
│   ├── git/                    # Git operations (feature-gated)
│   │   ├── mod.rs
│   │   └── git_service.rs     # Git service for version control operations
│   ├── import/                 # Import functionality
│   │   ├── mod.rs
│   │   ├── avro.rs            # AVRO format importer
│   │   ├── bpmn.rs            # BPMN 2.0 importer (feature-gated)
│   │   ├── cads.rs            # CADS format importer
│   │   ├── dmn.rs             # DMN 1.3 importer (feature-gated)
│   │   ├── json_schema.rs     # JSON Schema importer
│   │   ├── odcs.rs            # ODCS v3.1.0 format importer (primary, also handles ODCL)
│   │   ├── odps.rs            # ODPS format importer
│   │   ├── openapi.rs         # OpenAPI 3.1.1 importer (feature-gated)
│   │   ├── protobuf.rs        # Protobuf importer
│   │   └── sql.rs             # SQL DDL importer
│   ├── model/                  # Model loading/saving
│   │   ├── mod.rs
│   │   ├── api_loader.rs      # API-based model loader
│   │   ├── loader.rs          # File-based model loader
│   │   └── saver.rs           # Model saver
│   ├── models/                 # Core data structures
│   │   ├── mod.rs
│   │   ├── bpmn.rs            # BPMN model structs (BPMNModel, BPMNModelFormat) (feature-gated)
│   │   ├── cads.rs            # CADS model structs (CADSAsset, CADSKind, CADSBPMNModel, CADSDMNModel, CADSOpenAPISpec, etc.)
│   │   ├── column.rs          # Column and ForeignKey models
│   │   ├── cross_domain.rs    # Cross-domain relationship models
│   │   ├── data_model.rs      # DataModel container (includes domain operations)
│   │   ├── dmn.rs             # DMN model structs (DMNModel, DMNModelFormat) (feature-gated)
│   │   ├── domain.rs          # Business Domain schema models (Domain, System, CADSNode, ODCSNode, etc.)
│   │   ├── enums.rs           # Enums (DatabaseType, MedallionLayer, InfrastructureType, etc.)
│   │   ├── odps.rs            # ODPS model structs (ODPSDataProduct, ODPSInputPort, etc.)
│   │   ├── openapi.rs         # OpenAPI model structs (OpenAPIModel, OpenAPIFormat) (feature-gated)
│   │   ├── relationship.rs    # Relationship model
│   │   ├── table.rs           # Table model
│   │   └── tag.rs             # Enhanced Tag enum (Simple, Pair, List)
│   ├── storage/                # Storage backend abstraction
│   │   ├── mod.rs             # StorageBackend trait
│   │   ├── api.rs             # HTTP API backend (feature-gated)
│   │   ├── browser.rs         # Browser storage backend (WASM, feature-gated)
│   │   └── filesystem.rs      # File system backend (native, feature-gated)
│   ├── validation/             # Validation logic
│   │   ├── mod.rs
│   │   ├── input.rs           # Input validation (table/column names, UUIDs, model names, file sizes)
│   │   ├── relationships.rs   # Relationship validation (circular deps)
│   │   ├── tables.rs          # Table validation (naming conflicts)
│   │   └── xml.rs             # XML validation utilities (well-formedness checks)
│   └── workspace/              # Workspace management types
│       └── mod.rs             # WorkspaceInfo, ProfileInfo types
├── tests/                      # Test suite
│   ├── auth_tests.rs
│   ├── cads_tests.rs          # CADS import/export tests
│   ├── domain_tests.rs        # Business Domain schema tests
│   ├── export_tests.rs
│   ├── git_tests.rs
│   ├── import_tests.rs
│   ├── integration_tests.rs   # Includes DataFlow migration and universal converter tests
│   ├── model_tests.rs
│   ├── models_tests.rs
│   ├── nested_structures_tests.rs
│   ├── odcs_comprehensive_tests.rs
│   ├── odps_tests.rs          # ODPS import/export tests
│   ├── storage_tests.rs
│   ├── tag_tests.rs          # Enhanced tag support tests
│   ├── validation_tests.rs
│   └── workspace_tests.rs
├── schemas/                    # Schema reference directory
│   ├── README.md              # Schema documentation
│   ├── odcs-json-schema-v3.1.0.json  # ODCS v3.1.0 JSON Schema
│   ├── odcl-json-schema-1.2.1.json   # ODCL v1.2.1 JSON Schema (legacy)
│   ├── odps-json-schema-latest.json  # ODPS JSON Schema
│   └── cads.schema.json       # CADS v1.0 JSON Schema
├── docs/                       # Documentation
│   └── SCHEMA_OVERVIEW.md     # Comprehensive schema overview guide
├── specs/                      # Specification documents
│   └── 003-odcs-field-preservation/  # Current feature spec
│       ├── schemas/           # Original schema location (also copied to root schemas/)
│       └── ...
├── Cargo.toml                  # Package manifest
├── cargo-audit.toml           # Security audit configuration
├── .pre-commit-config.yaml    # Pre-commit hooks configuration
└── README.md                   # User documentation
```

## Key Modules

### Storage Backends (`src/storage/`)

Abstracts file operations across different environments:

- **`StorageBackend` trait**: Common interface for all storage backends
- **`FileSystemStorageBackend`**: Native file system operations (requires `native-fs` feature)
- **`BrowserStorageBackend`**: Browser IndexedDB/localStorage (WASM, requires `wasm` feature)
- **`ApiStorageBackend`**: HTTP API backend (requires `api-backend` feature, default)

### Models (`src/models/`)

Core data structures:

- **`Table`**: Represents a database table/data contract with columns, metadata, and relationships. Supports enhanced tags (Simple, Pair, List)
- **`Column`**: Column definition with data type, constraints, foreign keys. Includes `description`, `quality`, and `$ref` fields for ODCS/ODCL compatibility
- **`Relationship`**: Relationship between tables (source/target, type, metadata)
- **`DataModel`**: Container for tables, relationships, and domains. Includes filter methods and domain operations (`add_domain`, `add_system_to_domain`, etc.)
- **`Domain`**: Business domain container with systems, CADS nodes, ODCS nodes, and connections
- **`System`**: Physical infrastructure entity (Kafka, Cassandra, EKS, etc.) with DataFlow metadata (owner, SLA, contact_details, infrastructure_type, notes, version)
- **`CADSNode`**: Reference to CADS asset (AI/ML model, application, pipeline) with shared reference support
- **`ODCSNode`**: Reference to ODCS Table with shared reference support
- **`CADSAsset`**: CADS asset model (AIModel, MLPipeline, Application, etc.) with full CADS v1.0 support. Includes `bpmn_models`, `dmn_models`, and `openapi_specs` fields for referencing process/decision/API models.
- **`ODPSDataProduct`**: ODPS data product model with input/output ports, support, team, and custom properties
- **`BPMNModel`**: BPMN 2.0 process model stored in native XML format (requires `bpmn` feature)
- **`DMNModel`**: DMN 1.3 decision model stored in native XML format (requires `dmn` feature)
- **`OpenAPIModel`**: OpenAPI 3.1.1 specification stored in native YAML or JSON format (requires `openapi` feature)
- **`CADSBPMNModel`**: CADS reference to BPMN model (name, reference, format, description)
- **`CADSDMNModel`**: CADS reference to DMN model (name, reference, format, description)
- **`CADSOpenAPISpec`**: CADS reference to OpenAPI spec (name, reference, format, description)
- **`Tag`**: Enhanced tag enum supporting Simple, Pair, and List formats
- **`ForeignKey`**: Foreign key relationship details
- **`SlaProperty`**: SLA property structure (property, value, unit, element, driver, description, scheduler, schedule)
- **`ContactDetails`**: Contact details structure (email, phone, name, role, other)
- **Enums**: `DatabaseType`, `MedallionLayer`, `SCDPattern`, `DataVaultClassification`, `ModelingLevel`, `Cardinality`, `RelationshipType`, `InfrastructureType` (70+ infrastructure types), `CrowsfeetCardinality` (OneToOne, OneToMany, ZeroOrOne, ZeroOrMany), `CADSKind`, `CADSStatus`, `ODPSStatus`

### Import (`src/import/`)

Importers convert various formats to SDK models:

- **`ODCSImporter`**: Primary importer for ODCS v3.1.0 format (also handles legacy ODCL v1.2.1) - for Data Models (tables). Preserves `description`, `quality`, and `$ref` fields. Supports enhanced tags.
- **`CADSImporter`**: Importer for CADS v1.0 format - for compute assets (AI/ML models, applications, pipelines). Supports `bpmn_models`, `dmn_models`, and `openapi_specs` references.
- **`ODPSImporter`**: Importer for ODPS format - for data products linking to ODCS Tables
- **`BPMNImporter`**: Importer for BPMN 2.0 XML format - for business process models (requires `bpmn` feature)
- **`DMNImporter`**: Importer for DMN 1.3 XML format - for decision models (requires `dmn` feature)
- **`OpenAPIImporter`**: Importer for OpenAPI 3.1.1 YAML/JSON format - for API specifications (requires `openapi` feature)
- **`SQLImporter`**: SQL DDL parser (CREATE TABLE, CREATE VIEW, CREATE MATERIALIZED VIEW statements)
  - Supported SQL dialects: PostgreSQL, MySQL, SQLite, Generic (default), and Databricks
  - Databricks dialect supports: `IDENTIFIER()` function calls, variable references (`:variable_name`) in types/columns/metadata, `STRUCT`/`ARRAY` complex types, and views/materialized views
- **`JSONSchemaImporter`**: JSON Schema to Table conversion
- **`AvroImporter`**: AVRO schema to Table conversion
- **`ProtobufImporter`**: Protobuf .proto files to Table conversion

### Export (`src/export/`)

Exporters convert SDK models to various formats:

- **`ODCSExporter`**: Exports to ODCS v3.1.0 format - for Data Models (tables). Preserves all fields including `description`, `quality`, and `$ref`. Supports enhanced tags.
- **`ODCLExporter`**: Exports to ODCL v1.2.1 format - for legacy compatibility
- **`CADSExporter`**: Exports to CADS v1.0 format - for compute assets. Supports `bpmn_models`, `dmn_models`, and `openapi_specs` references.
- **`ODPSExporter`**: Exports to ODPS format - for data products
- **`BPMNExporter`**: Exports BPMN models in native XML format (requires `bpmn` feature)
- **`DMNExporter`**: Exports DMN models in native XML format (requires `dmn` feature)
- **`OpenAPIExporter`**: Exports OpenAPI specs with YAML ↔ JSON conversion support (requires `openapi` feature)
- **`SQLExporter`**: Generates SQL DDL (CREATE TABLE statements)
  - Supports multiple SQL dialects: PostgreSQL, MySQL, SQLite, Generic, and Databricks
- **`JSONSchemaExporter`**: Exports to JSON Schema format
- **`AvroExporter`**: Exports to AVRO schema format
- **`ProtobufExporter`**: Exports to Protobuf .proto format
- **`PNGExporter`**: Generates PNG diagrams (requires `png-export` feature)

### Model Management (`src/model/`)

- **`ModelLoader`**: Loads models from storage backends. Supports both legacy `tables/` directory structure and new domain-based structure:
  - `load_model()`: Legacy method for loading from `tables/` directory
  - `load_domains()`: Loads all domains from domain directories (auto-discovery)
  - `load_domains_from_list()`: Loads domains from explicit directory names
  - `load_domain()`: Loads a single domain from a domain directory
  - `load_domain_odcs_tables()`: Loads ODCS tables from a domain directory
  - `load_domain_odps_products()`: Loads ODPS products from a domain directory
  - `load_domain_cads_assets()`: Loads CADS assets from a domain directory
  - `load_bpmn_models()`: Loads BPMN models from a domain directory (requires `bpmn` feature)
  - `load_bpmn_model()`: Loads a specific BPMN model by name (requires `bpmn` feature)
  - `load_bpmn_xml()`: Loads BPMN XML content (requires `bpmn` feature)
  - `load_dmn_models()`: Loads DMN models from a domain directory (requires `dmn` feature)
  - `load_dmn_model()`: Loads a specific DMN model by name (requires `dmn` feature)
  - `load_dmn_xml()`: Loads DMN XML content (requires `dmn` feature)
  - `load_openapi_models()`: Loads OpenAPI specs from a domain directory (requires `openapi` feature)
  - `load_openapi_model()`: Loads a specific OpenAPI spec by name (requires `openapi` feature)
  - `load_openapi_content()`: Loads OpenAPI content (requires `openapi` feature)
- **`ModelSaver`**: Saves models to storage backends. Supports domain-based file structure:
  - `save_table()`: Legacy method for saving to `tables/` directory
  - `save_domain()`: Saves domain with all associated ODCS/ODPS/CADS files to domain directory
  - `save_odps_product()`: Saves ODPS product to domain directory
  - `save_cads_asset()`: Saves CADS asset to domain directory
  - `save_bpmn_model()`: Saves BPMN model to domain directory (requires `bpmn` feature)
  - `save_dmn_model()`: Saves DMN model to domain directory (requires `dmn` feature)
  - `save_openapi_model()`: Saves OpenAPI spec to domain directory (requires `openapi` feature)
- **`ApiModelLoader`**: Loads models via HTTP API
- **`DomainLoadResult`**: Result structure containing loaded domains, tables, ODPS products, and CADS assets

### Converters (`src/convert/`)

- **`convert_to_odcs()`**: Universal converter that converts any supported format to ODCS v3.1.0 format. Supports auto-detection or explicit format specification. Formats: SQL, ODCS, ODCL, JSON Schema, AVRO, Protobuf, CADS, ODPS, Domain.
- **`OpenAPIToODCSConverter`**: Converts OpenAPI 3.1.1 schema components to ODCS table definitions (requires `openapi` feature)
  - `convert_component()`: Converts a single OpenAPI component to an ODCS table
  - `convert_components()`: Converts multiple OpenAPI components to ODCS tables
  - `analyze_conversion()`: Analyzes conversion feasibility and returns a conversion report
  - Type mapping: OpenAPI types (string, integer, number, boolean) mapped to ODCS types
  - Constraint preservation: minLength, maxLength, pattern, minimum, maximum, enum converted to ODCS quality rules
  - Format support: date, date-time, email, uri, uuid, password formats handled
- **`migrate_dataflow_to_domain()`**: Migrates legacy DataFlow YAML format to Domain schema format

### Validation (`src/validation/`)

- **`TableValidator`**: Validates table names, detects naming conflicts
- **`RelationshipValidator`**: Validates relationships, detects circular dependencies
- **`InputValidator`**: Validates table/column names, UUIDs, SQL identifiers, model names, file sizes
- **`XML validation utilities`**: Basic XML well-formedness checks for BPMN/DMN (requires `bpmn`/`dmn` features)
- **`DataModel` filter methods**: `filter_nodes_by_owner()`, `filter_relationships_by_owner()`, `filter_nodes_by_infrastructure_type()`, `filter_relationships_by_infrastructure_type()`, `filter_by_tags()` (supports enhanced tags)
- **`DataModel` domain methods**: `add_domain()`, `get_domain_by_id()`, `get_domain_by_name()`, `add_system_to_domain()`, `add_cads_node_to_domain()`, `add_odcs_node_to_domain()`, `add_system_connection_to_domain()`, `add_node_connection_to_domain()`

### Git Operations (`src/git/`)

- **`GitService`**: Git operations (status, commit, push, pull) - requires `git` feature

## Features

The SDK uses Cargo features to enable optional functionality:

- **`default`**: Includes `api-backend` (HTTP API support)
- **`api-backend`**: Enables `ApiStorageBackend` (reqwest, urlencoding)
- **`native-fs`**: Enables `FileSystemStorageBackend` (tokio)
- **`wasm`**: Enables `BrowserStorageBackend` (wasm-bindgen, web-sys)
- **`png-export`**: Enables PNG diagram export (image, imageproc)
- **`databricks-dialect`**: Enables Databricks SQL dialect support (datafusion)
- **`git`**: Enables Git operations (git2)

## Dependencies

### Core Dependencies
- `serde`, `serde_json`, `serde_yaml`: Serialization
- `anyhow`, `thiserror`: Error handling
- `async-trait`: Async trait support
- `uuid`: UUID generation (v4 random, v5 deterministic)
- `chrono`: Timestamps
- `tracing`: Logging
- `petgraph`: Graph operations for validation

### Optional Dependencies
- `tokio`: Async runtime (for `native-fs` feature)
- `reqwest`: HTTP client (for `api-backend` feature)
- `wasm-bindgen`, `web-sys`: WASM support (for `wasm` feature)
- `git2`: Git operations (for `git` feature)
- `image`, `imageproc`: Image processing (for `png-export` feature)
- `datafusion`: SQL parsing (for `databricks-dialect` feature)
- `sqlparser`: SQL parsing
- `yaml-rust`: YAML processing

## Usage Examples

### File System Backend (Native Apps)

```rust
use data_modelling_sdk::storage::filesystem::FileSystemStorageBackend;
use data_modelling_sdk::model::ModelLoader;

let storage = FileSystemStorageBackend::new("/path/to/workspace");
let loader = ModelLoader::new(storage);
let result = loader.load_model("workspace_path").await?;
```

### Browser Storage Backend (WASM Apps)

```rust
use data_modelling_sdk::storage::browser::BrowserStorageBackend;
use data_modelling_sdk::model::ModelLoader;

let storage = BrowserStorageBackend::new("db_name", "store_name");
let loader = ModelLoader::new(storage);
let result = loader.load_model("workspace_path").await?;
```

### API Backend (Online Mode)

```rust
use data_modelling_sdk::storage::api::ApiStorageBackend;
use data_modelling_sdk::model::ModelLoader;

let storage = ApiStorageBackend::new("http://localhost:8081/api/v1", Some("session_id"));
let loader = ModelLoader::new(storage);
let result = loader.load_model("workspace_path").await?;
```

### Import/Export

```rust
use data_modelling_sdk::import::ODCSImporter;
use data_modelling_sdk::export::ODCSExporter;

// Import
let mut importer = ODCSImporter::new();
let result = importer.import(yaml_content)?;

// Export
let exporter = ODCSExporter::new();
let yaml = exporter.export_table(&table)?;
```

### Validation

```rust
use data_modelling_sdk::validation::{TableValidator, RelationshipValidator};

let table_validator = TableValidator::new();
let result = table_validator.detect_naming_conflicts(&tables)?;

let rel_validator = RelationshipValidator::new();
let (has_cycle, cycle_path) = rel_validator.check_circular_dependency(&relationships, source_id, target_id)?;
```

## Testing

The SDK includes comprehensive tests:

- **Unit tests**: Individual module tests
- **Integration tests**: End-to-end workflows
- **Doctests**: Documentation examples

Run tests:
```bash
# All tests
cargo test --all-features

# Specific test suite
cargo test --test model_tests --features native-fs

# With output
cargo test --all-features -- --nocapture
```

## Development Workflow

### Pre-commit Hooks

The project uses pre-commit hooks for code quality:

```bash
# Install pre-commit
pip install pre-commit

# Install hooks
pre-commit install

# Run manually
pre-commit run --all-files
```

Hooks check:
- Rust formatting (`cargo fmt`)
- Rust linting (`cargo clippy`)
- Security audit (`cargo audit`)
- File formatting (trailing whitespace, end of file)
- YAML/TOML/JSON syntax

### CI/CD

GitHub Actions workflows:
- **Lint**: Format check, clippy, security audit
- **Test**: Unit and integration tests on Linux, macOS, Windows
- **Build**: Release build verification
- **Publish**: Automatic publishing to crates.io (manual trigger)

### Building

```bash
# Development build
cargo build

# Release build
cargo build --release

# With specific features
cargo build --features native-fs,git

# All features
cargo build --all-features
```

## File Structure

The SDK organizes files using a domain-based directory structure:

```
base_directory/
├── .git/                     # Git folder (if present)
├── README.md                 # Repository files
├── schemas/                  # Schema reference directory
│   ├── README.md
│   ├── odcs-json-schema-v3.1.0.json
│   ├── odcl-json-schema-1.2.1.json
│   ├── odps-json-schema-latest.json
│   └── cads.schema.json
├── domain1/                  # Domain directory
│   ├── domain.yaml          # Domain definition
│   ├── table1.odcs.yaml     # ODCS table files
│   ├── product1.odps.yaml   # ODPS product files
│   └── model1.cads.yaml    # CADS asset files
├── domain2/                  # Another domain directory
│   └── ...
└── tables/                    # Legacy: tables not in any domain (backward compatibility)
```

Each domain directory contains:
- `domain.yaml`: Domain definition with systems, CADS nodes, ODCS nodes, and connections
- `*.odcs.yaml`: ODCS table files referenced by ODCSNodes in the domain
- `*.odps.yaml`: ODPS product files for data products in the domain
- `*.cads.yaml`: CADS asset files referenced by CADSNodes in the domain
- `*.openapi.yaml` / `*.openapi.json`: OpenAPI specification files (can be referenced by CADS assets)
- `*.bpmn.xml`: BPMN 2.0 process model files (can be referenced by CADS assets)
- `*.dmn.xml`: DMN 1.3 decision model files (can be referenced by CADS assets)

## Key Design Decisions

1. **Storage Abstraction**: Uses trait-based storage backends to support multiple environments (native, WASM, API)
2. **Feature Flags**: Optional functionality gated behind features to minimize dependencies
3. **Async/Await**: Uses async traits for storage operations to support both native and WASM
4. **Error Handling**: Uses `anyhow::Result` for convenience, `thiserror` for structured errors
5. **UUID Strategy**: Uses UUIDv5 (deterministic) for model/table IDs to avoid random number generation requirements
6. **ODCS Primary Format**: ODCS v3.1.0 is the primary format, with legacy ODCL support for backward compatibility
7. **Domain-Based Organization**: Files are organized by business domain, with each domain containing its definition and associated ODCS/ODPS/CADS files
8. **Schema Reference**: JSON Schema definitions for all supported formats are maintained in `schemas/` directory for validation and reference

## Common Patterns

### Error Handling

The SDK uses `anyhow::Result` for most operations:

```rust
use anyhow::Result;

pub async fn load_model(&self, path: &str) -> Result<ModelLoadResult, StorageError> {
    // ...
}
```

### Storage Operations

All storage operations are async and use the `StorageBackend` trait:

```rust
#[async_trait(?Send)]
pub trait StorageBackend: Send + Sync {
    async fn read_file(&self, path: &str) -> Result<Vec<u8>, StorageError>;
    async fn write_file(&self, path: &str, content: &[u8]) -> Result<(), StorageError>;
    // ...
}
```

### Import/Export Pattern

Importers convert external formats to SDK `Table` models, exporters convert SDK models to external formats:

```rust
pub trait Importer {
    fn import(&mut self, content: &str) -> Result<ImportResult, ImportError>;
}

pub trait Exporter {
    fn export_table(&self, table: &Table) -> Result<String, ExportError>;
}
```

## Schema Reference

The SDK maintains JSON Schema definitions for all supported formats in the `schemas/` directory:

- **ODCS v3.1.0**: `schemas/odcs-json-schema-v3.1.0.json` - Primary format for data contracts
- **ODCL v1.2.1**: `schemas/odcl-json-schema-1.2.1.json` - Legacy data contract format
- **ODPS**: `schemas/odps-json-schema-latest.json` - Data products linking to ODCS tables
- **CADS v1.0**: `schemas/cads.schema.json` - Compute assets (AI/ML models, applications, pipelines)
- **BPMN 2.0**: `schemas/bpmn-2.0.xsd` - Business Process Model and Notation (process models in native XML)
- **DMN 1.3**: `schemas/dmn-1.3.xsd` - Decision Model and Notation (decision models in native XML)
- **OpenAPI 3.1.1**: `schemas/openapi-3.1.1.json` - API specifications (stored in native YAML or JSON)

These schemas serve as authoritative references for:
- **Validation**: Validating imported YAML/JSON files against official specifications
- **Documentation**: Understanding the structure and fields of each format
- **Compliance**: Ensuring the SDK maintains full coverage of each specification
- **Reference**: Quick lookup for field definitions and types

See `schemas/README.md` for detailed information about each schema.

## Security

- Security advisories are tracked via `cargo audit`
- Configuration in `cargo-audit.toml` allows specific unmaintained warnings
- Pre-commit hooks run security audits automatically

## License

MIT License - See LICENSE file for details.
