pub struct SchemaObject {Show 13 fields
pub id: Option<String>,
pub name: String,
pub physical_name: Option<String>,
pub physical_type: Option<String>,
pub business_name: Option<String>,
pub description: Option<String>,
pub data_granularity_description: Option<String>,
pub properties: Vec<Property>,
pub relationships: Vec<SchemaRelationship>,
pub quality: Vec<QualityRule>,
pub authoritative_definitions: Vec<AuthoritativeDefinition>,
pub tags: Vec<String>,
pub custom_properties: Vec<CustomProperty>,
}Expand description
SchemaObject - one table/view/topic in a contract (ODCS v3.1.0)
Schema objects represent individual data structures within a contract. Each schema object contains properties (columns) and can have its own metadata like quality rules, relationships, and authoritative definitions.
§Example
use data_modelling_core::models::odcs::{SchemaObject, Property};
let users_table = SchemaObject::new("users")
.with_physical_name("tbl_users")
.with_physical_type("table")
.with_business_name("User Accounts")
.with_description("Contains registered user information")
.with_properties(vec![
Property::new("id", "integer").with_primary_key(true),
Property::new("email", "string").with_required(true),
Property::new("name", "string"),
]);Fields§
§id: Option<String>Stable technical identifier
name: StringSchema object name (table/view name)
physical_name: Option<String>Physical name in the data source
physical_type: Option<String>Physical type (“table”, “view”, “topic”, “file”, “object”, “stream”)
business_name: Option<String>Business name for the schema object
description: Option<String>Schema object description/documentation
data_granularity_description: Option<String>Description of the data granularity (e.g., “One row per customer per day”)
properties: Vec<Property>List of properties/columns in this schema object
relationships: Vec<SchemaRelationship>Schema-level relationships to other schema objects
quality: Vec<QualityRule>Quality rules and checks at schema level
Authoritative definitions for this schema object
Schema-level tags
custom_properties: Vec<CustomProperty>Custom properties for format-specific metadata
Implementations§
Source§impl SchemaObject
impl SchemaObject
Sourcepub fn with_physical_name(self, physical_name: impl Into<String>) -> Self
pub fn with_physical_name(self, physical_name: impl Into<String>) -> Self
Set the physical name
Sourcepub fn with_physical_type(self, physical_type: impl Into<String>) -> Self
pub fn with_physical_type(self, physical_type: impl Into<String>) -> Self
Set the physical type
Sourcepub fn with_business_name(self, business_name: impl Into<String>) -> Self
pub fn with_business_name(self, business_name: impl Into<String>) -> Self
Set the business name
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the description
Sourcepub fn with_data_granularity_description(
self,
description: impl Into<String>,
) -> Self
pub fn with_data_granularity_description( self, description: impl Into<String>, ) -> Self
Set the data granularity description
Sourcepub fn with_properties(self, properties: Vec<Property>) -> Self
pub fn with_properties(self, properties: Vec<Property>) -> Self
Set the properties (columns)
Sourcepub fn with_property(self, property: Property) -> Self
pub fn with_property(self, property: Property) -> Self
Add a property
Sourcepub fn with_relationships(self, relationships: Vec<SchemaRelationship>) -> Self
pub fn with_relationships(self, relationships: Vec<SchemaRelationship>) -> Self
Set the relationships
Sourcepub fn with_relationship(self, relationship: SchemaRelationship) -> Self
pub fn with_relationship(self, relationship: SchemaRelationship) -> Self
Add a relationship
Sourcepub fn with_quality(self, quality: Vec<QualityRule>) -> Self
pub fn with_quality(self, quality: Vec<QualityRule>) -> Self
Set the quality rules
Sourcepub fn with_quality_rule(self, rule: QualityRule) -> Self
pub fn with_quality_rule(self, rule: QualityRule) -> Self
Add a quality rule
Set the authoritative definitions
Add an authoritative definition
Set the tags
Sourcepub fn with_custom_properties(
self,
custom_properties: Vec<CustomProperty>,
) -> Self
pub fn with_custom_properties( self, custom_properties: Vec<CustomProperty>, ) -> Self
Set the custom properties
Sourcepub fn with_custom_property(self, custom_property: CustomProperty) -> Self
pub fn with_custom_property(self, custom_property: CustomProperty) -> Self
Add a custom property
Sourcepub fn primary_key_properties(&self) -> Vec<&Property>
pub fn primary_key_properties(&self) -> Vec<&Property>
Get the primary key properties
Sourcepub fn required_properties(&self) -> Vec<&Property>
pub fn required_properties(&self) -> Vec<&Property>
Get the required properties
Sourcepub fn get_property(&self, name: &str) -> Option<&Property>
pub fn get_property(&self, name: &str) -> Option<&Property>
Get a property by name
Sourcepub fn get_property_mut(&mut self, name: &str) -> Option<&mut Property>
pub fn get_property_mut(&mut self, name: &str) -> Option<&mut Property>
Get a mutable property by name
Sourcepub fn property_count(&self) -> usize
pub fn property_count(&self) -> usize
Count of properties
Sourcepub fn has_nested_properties(&self) -> bool
pub fn has_nested_properties(&self) -> bool
Check if this schema has any nested/complex properties
Trait Implementations§
Source§impl Clone for SchemaObject
impl Clone for SchemaObject
Source§fn clone(&self) -> SchemaObject
fn clone(&self) -> SchemaObject
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SchemaObject
impl Debug for SchemaObject
Source§impl Default for SchemaObject
impl Default for SchemaObject
Source§fn default() -> SchemaObject
fn default() -> SchemaObject
Source§impl<'de> Deserialize<'de> for SchemaObject
impl<'de> Deserialize<'de> for SchemaObject
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<&SchemaObject> for Table
impl From<&SchemaObject> for Table
Source§fn from(schema: &SchemaObject) -> Self
fn from(schema: &SchemaObject) -> Self
Convert a SchemaObject to a Table
This flattens nested properties to dot-notation column names.