Skip to main content

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);

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

Structs§

AuthoritativeDefinition
Authoritative definition reference (ODCS v3.1.0)
CustomProperty
Custom property for format-specific metadata (ODCS v3.1.0)
Link
Link to external resource (ODCS v3.1.0)
LogicalTypeOptions
Logical type options for additional type metadata (ODCS v3.1.0)
ODCSContract
ODCSContract - the root data contract document (ODCS v3.1.0)
Price
Price information (ODCS v3.1.0)
Property
Property - one column in a schema object (ODCS v3.1.0)
PropertyRelationship
Property-level relationship (ODCS v3.1.0)
QualityRule
Quality rule for data validation (ODCS v3.1.0)
Role
Role definition (ODCS v3.1.0)
SchemaObject
SchemaObject - one table/view/topic in a contract (ODCS v3.1.0)
SchemaRelationship
Schema-level relationship (ODCS v3.1.0)
Server
Server configuration (ODCS v3.1.0)
ServiceLevel
Service level definition (ODCS v3.1.0)
StructuredDescription
Structured description with multiple fields
Support
Support information (ODCS v3.1.0)
Team
Team information (ODCS v3.1.0)
TeamMember
Team member information
Terms
Terms and conditions (ODCS v3.1.0)

Enums§

Description
Description that can be string or structured object (ODCS v3.1.0)