pub struct Property {Show 31 fields
pub id: Option<String>,
pub name: String,
pub business_name: Option<String>,
pub description: Option<String>,
pub logical_type: String,
pub physical_type: Option<String>,
pub physical_name: Option<String>,
pub logical_type_options: Option<LogicalTypeOptions>,
pub required: bool,
pub primary_key: bool,
pub primary_key_position: Option<i32>,
pub unique: bool,
pub partitioned: bool,
pub partition_key_position: Option<i32>,
pub clustered: bool,
pub classification: Option<String>,
pub critical_data_element: bool,
pub encrypted_name: Option<String>,
pub transform_source_objects: Vec<String>,
pub transform_logic: Option<String>,
pub transform_description: Option<String>,
pub examples: Vec<Value>,
pub default_value: Option<Value>,
pub relationships: Vec<PropertyRelationship>,
pub authoritative_definitions: Vec<AuthoritativeDefinition>,
pub quality: Vec<QualityRule>,
pub enum_values: Vec<String>,
pub tags: Vec<String>,
pub custom_properties: Vec<CustomProperty>,
pub items: Option<Box<Property>>,
pub properties: Vec<Property>,
}Expand description
Property - one column in a schema object (ODCS v3.1.0)
Properties represent individual fields in a schema. They support nested
structures through the properties field (for OBJECT types) and the
items field (for ARRAY types).
§Example
use data_modelling_core::models::odcs::{Property, LogicalTypeOptions};
// Simple property
let id_prop = Property::new("id", "integer")
.with_primary_key(true)
.with_required(true);
// Nested object property
let address_prop = Property::new("address", "object")
.with_nested_properties(vec![
Property::new("street", "string"),
Property::new("city", "string"),
Property::new("zip", "string"),
]);
// Array property
let tags_prop = Property::new("tags", "array")
.with_items(Property::new("", "string"));Fields§
§id: Option<String>Stable technical identifier
name: StringProperty name
business_name: Option<String>Business name for the property
description: Option<String>Property description/documentation
logical_type: StringLogical data type (e.g., “string”, “integer”, “number”, “boolean”, “object”, “array”)
physical_type: Option<String>Physical database type (e.g., “VARCHAR(100)”, “BIGINT”)
physical_name: Option<String>Physical name in the data source
logical_type_options: Option<LogicalTypeOptions>Additional type options (min/max length, pattern, precision, etc.)
required: boolWhether the property is required (inverse of nullable)
primary_key: boolWhether this property is part of the primary key
primary_key_position: Option<i32>Position in composite primary key, 1-based
unique: boolWhether the property contains unique values
partitioned: boolWhether the property is used for partitioning
partition_key_position: Option<i32>Position in partition key, 1-based
clustered: boolWhether the property is used for clustering
classification: Option<String>Data classification level (e.g., “confidential”, “public”)
critical_data_element: boolWhether this is a critical data element
encrypted_name: Option<String>Name of the encrypted version of this property
transform_source_objects: Vec<String>Source objects used in transformation
transform_logic: Option<String>Transformation logic/expression
transform_description: Option<String>Human-readable transformation description
examples: Vec<Value>Example values for this property
default_value: Option<Value>Default value for the property
relationships: Vec<PropertyRelationship>Property-level relationships
Authoritative definitions
quality: Vec<QualityRule>Quality rules and checks
enum_values: Vec<String>Enum values if this property is an enumeration type
Property-level tags
custom_properties: Vec<CustomProperty>Custom properties for format-specific metadata
items: Option<Box<Property>>For ARRAY types: the item type definition
properties: Vec<Property>For OBJECT types: nested property definitions
Implementations§
Source§impl Property
impl Property
Sourcepub fn new(name: impl Into<String>, logical_type: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, logical_type: impl Into<String>) -> Self
Create a new property with the given name and logical type
Sourcepub fn with_required(self, required: bool) -> Self
pub fn with_required(self, required: bool) -> Self
Set the property as required
Sourcepub fn with_primary_key(self, primary_key: bool) -> Self
pub fn with_primary_key(self, primary_key: bool) -> Self
Set the property as a primary key
Sourcepub fn with_primary_key_position(self, position: i32) -> Self
pub fn with_primary_key_position(self, position: i32) -> Self
Set the primary key position
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the property description
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_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_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_nested_properties(self, properties: Vec<Property>) -> Self
pub fn with_nested_properties(self, properties: Vec<Property>) -> Self
Set nested properties (for OBJECT types)
Sourcepub fn with_items(self, items: Property) -> Self
pub fn with_items(self, items: Property) -> Self
Set items property (for ARRAY types)
Sourcepub fn with_enum_values(self, values: Vec<String>) -> Self
pub fn with_enum_values(self, values: Vec<String>) -> Self
Set enum values
Sourcepub fn with_custom_property(self, property: CustomProperty) -> Self
pub fn with_custom_property(self, property: CustomProperty) -> Self
Add a custom property
Sourcepub fn with_unique(self, unique: bool) -> Self
pub fn with_unique(self, unique: bool) -> Self
Set unique constraint
Sourcepub fn with_classification(self, classification: impl Into<String>) -> Self
pub fn with_classification(self, classification: impl Into<String>) -> Self
Set classification
Sourcepub fn has_nested_structure(&self) -> bool
pub fn has_nested_structure(&self) -> bool
Check if this property has nested structure (OBJECT or ARRAY type)
Sourcepub fn flatten_to_paths(&self) -> Vec<(String, &Property)>
pub fn flatten_to_paths(&self) -> Vec<(String, &Property)>
Get all nested properties recursively, returning (path, property) pairs
Path uses dot notation for nested objects and [] for arrays
Sourcepub fn from_flat_paths(paths: &[(String, Property)]) -> Vec<Property>
pub fn from_flat_paths(paths: &[(String, Property)]) -> Vec<Property>
Create a property tree from a list of flattened columns with dot-notation names
This reconstructs the hierarchical structure from paths like:
- “address.street” -> nested object
- “tags.[]” -> array items
- “items.[].name” -> array of objects