Skip to content

Conversation

@kunitoki
Copy link
Owner

@kunitoki kunitoki commented Aug 26, 2025

Add DataTree System with Query, Schema, and Cached Values

This PR introduces a new powerful hierarchical data model system to YUP, centered around the DataTree class. This system provides a robust foundation for storing and manipulating structured data with transactions, validation, and efficient querying.

Core Components

DataTree: A transactional hierarchical data structure that replaces traditional ValueTree with enhanced performance, safety, and usability
DataTreeQuery: A sophisticated query engine with both fluent API and XPath-like syntax for extracting data
DataTreeSchema: JSON Schema-based validation for DataTree structures
CachedValue/AtomicCachedValue: Reactive property wrappers that update automatically when data changes
DataTreeObjectList: Collection management for binding C++ objects to DataTree nodes

Key Features

Transactional Operations: All changes are performed through transactions for atomicity
Schema Validation: Define constraints, defaults, and validation rules using JSON Schema
Reactive Properties: Cached values automatically update when the underlying data changes
Thread Safety: Atomic cached values for concurrent access
Efficient Querying: Powerful query system for navigating, filtering, and transforming data
Object Binding: Synchronize C++ objects with the data model

Documentation

Added a comprehensive tutorial for the DataTree system that explains:

  • Basic usage and concepts
  • Query syntax and patterns
  • Schema validation
  • Cached values for reactive programming
  • Object list management

Other Changes

  • Added getProperty(propertyName, defaultValue) to DynamicObject
  • Enhanced HashMap with Identifier key support and convenience methods

This new data model provides a foundation for building more complex state management, configurations, and object hierarchies in YUP applications.

@codecov
Copy link

codecov bot commented Aug 26, 2025

Codecov Report

❌ Patch coverage is 86.05948% with 300 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.33%. Comparing base (45fd338) to head (eb44f90).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
modules/yup_data_model/tree/yup_DataTree.cpp 80.21% 150 Missing ⚠️
modules/yup_data_model/tree/yup_DataTreeQuery.cpp 90.20% 73 Missing ⚠️
modules/yup_data_model/tree/yup_DataTreeSchema.cpp 89.89% 30 Missing ⚠️
...odules/yup_data_model/tree/yup_AtomicCachedValue.h 78.57% 15 Missing ⚠️
...dules/yup_data_model/tree/yup_DataTreeObjectList.h 81.69% 13 Missing ⚠️
modules/yup_data_model/tree/yup_DataTree.h 85.71% 8 Missing ⚠️
modules/yup_data_model/tree/yup_CachedValue.h 92.55% 7 Missing ⚠️
modules/yup_data_model/tree/yup_DataTreeQuery.h 92.10% 3 Missing ⚠️
modules/yup_data_model/tree/yup_DataTreeSchema.h 90.90% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #74      +/-   ##
==========================================
+ Coverage   57.74%   59.33%   +1.58%     
==========================================
  Files         475      484       +9     
  Lines       44155    46331    +2176     
==========================================
+ Hits        25499    27490    +1991     
- Misses      18656    18841     +185     
Files with missing lines Coverage Δ
modules/yup_core/containers/yup_DynamicObject.cpp 100.00% <100.00%> (ø)
modules/yup_core/containers/yup_DynamicObject.h 66.66% <ø> (ø)
modules/yup_core/containers/yup_HashMap.h 98.22% <100.00%> (+0.32%) ⬆️
modules/yup_data_model/tree/yup_DataTreeSchema.h 90.90% <90.90%> (ø)
modules/yup_data_model/tree/yup_DataTreeQuery.h 92.10% <92.10%> (ø)
modules/yup_data_model/tree/yup_CachedValue.h 92.55% <92.55%> (ø)
modules/yup_data_model/tree/yup_DataTree.h 85.71% <85.71%> (ø)
...dules/yup_data_model/tree/yup_DataTreeObjectList.h 81.69% <81.69%> (ø)
...odules/yup_data_model/tree/yup_AtomicCachedValue.h 78.57% <78.57%> (ø)
modules/yup_data_model/tree/yup_DataTreeSchema.cpp 89.89% <89.89%> (ø)
... and 2 more

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5376c4a...eb44f90. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kunitoki kunitoki merged commit de12491 into main Dec 6, 2025
36 checks passed
@kunitoki kunitoki deleted the dev/data_tree_classes branch December 6, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants