Skip to content

Implement Property Type Dispatch and Validation in [property_type.rs] #4

@Shubh-Raj

Description

@Shubh-Raj

Summary

The file src/property_type.rs is currently empty. The property type validation system needs implementation — currently, validate_property_type() in model_manager.rs is a stub that always returns Ok(()), and all PropertyValidator implementations for primitive types (StringProperty, IntegerProperty, DoubleProperty, LongProperty, BooleanProperty, DateTimeProperty) are no-ops via macro.

This means none of the following are being validated:

  • String regex validators (is the regex pattern valid?)
  • String length validators (is minLength ≤ maxLength? are both ≥ 0?)
  • Integer/Long/Double range validators (is lower ≤ upper?)
  • Default values (is the default within the declared range?)
  • Object property type references (does the referenced type exist?)
  • Relationship property type references (does the referenced type exist and is it identified?)

Proposal

Implement a PropertyType enum in property_type.rs that:

  1. Parses the _class discriminator string on Property to determine the concrete property type (e.g., "concerto.metamodel@1.0.0.StringProperty"PropertyType::String)
  2. Validates type-specific constraints (regex compilation, range validity, type reference resolution)
  3. Integrates with ModelManager::validate_property_type() to replace the current no-op stub

Context

The metamodel defines 9 property types (Property, StringProperty, IntegerProperty, LongProperty, DoubleProperty, BooleanProperty, DateTimeProperty, ObjectProperty, RelationshipProperty), each with different extra fields (validators, default values, type references). However, concepts currently store properties as Vec<Property> — the generic struct that lacks these type-specific fields.

The _class field on each Property already contains the type discriminator, but no dispatch logic exists to extract or validate type-specific data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions