Module odcs

Module odcs 

Source
Expand description

ODCS Native Data Structures

This module provides native Rust types that model the ODCS (Open Data Contract Standard) v3.1.0 specification accurately. These types preserve the three-level hierarchy:

  1. Contract Level (ODCSContract) - Root document with metadata
  2. Schema Level (SchemaObject) - Tables/views/topics within a contract
  3. Property Level (Property) - Columns/fields within a schema

§Design Goals

  • Zero data loss: Full round-trip import/export without losing metadata
  • Multi-table support: Native support for contracts with multiple schema objects
  • Nested properties: Proper hierarchical representation for OBJECT and ARRAY types
  • Format mapping: Clean mapping from Avro, Protobuf, JSON Schema, OpenAPI via custom properties
  • Backwards compatibility: Converters to/from existing Table/Column types

§Example

use data_modelling_core::models::odcs::{ODCSContract, SchemaObject, Property};

// Create a contract with two tables
let contract = ODCSContract::new("ecommerce", "1.0.0")
    .with_domain("retail")
    .with_status("active")
    .with_schema(
        SchemaObject::new("orders")
            .with_physical_type("table")
            .with_properties(vec![
                Property::new("id", "integer").with_primary_key(true),
                Property::new("customer_id", "integer").with_required(true),
                Property::new("total", "number"),
            ])
    )
    .with_schema(
        SchemaObject::new("order_items")
            .with_physical_type("table")
            .with_properties(vec![
                Property::new("id", "integer").with_primary_key(true),
                Property::new("order_id", "integer").with_required(true),
                Property::new("product_name", "string"),
            ])
    );

assert_eq!(contract.schema_count(), 2);

Re-exports§

pub use contract::ODCSContract;
pub use property::Property;
pub use schema::SchemaObject;
pub use supporting::AuthoritativeDefinition;
pub use supporting::CustomProperty;
pub use supporting::Description;
pub use supporting::LogicalTypeOptions;
pub use supporting::Price;
pub use supporting::PropertyRelationship;
pub use supporting::QualityRule;
pub use supporting::Role;
pub use supporting::SchemaRelationship;
pub use supporting::Server;
pub use supporting::ServiceLevel;
pub use supporting::StructuredDescription;
pub use supporting::Support;
pub use supporting::Team;
pub use supporting::TeamMember;
pub use supporting::Terms;

Modules§

contract
ODCSContract type for ODCS native data structures
converters
Converters between ODCS native types and legacy Table/Column types
property
Property type for ODCS native data structures
schema
SchemaObject type for ODCS native data structures
supporting
Supporting types for ODCS native data structures