Skip to content

Format Overhaul - Enhanced JSON Schema Support and Asset Management#19

Merged
afshawnlotfi merged 7 commits intomainfrom
format-overhaul-typescript
Feb 13, 2026
Merged

Format Overhaul - Enhanced JSON Schema Support and Asset Management#19
afshawnlotfi merged 7 commits intomainfrom
format-overhaul-typescript

Conversation

@afshawnlotfi
Copy link
Member

@afshawnlotfi afshawnlotfi commented Feb 13, 2026

Summary

Major refactoring of the Packable/Mesh extraction and reconstruction system with improved JSON schema hints, consolidated file format, and enhanced VTK export capabilities. Changes span both Python and TypeScript implementations.

Breaking Changes ⚠️

  • File format change: Replaced separate metadata/data.json and metadata/schema.json files with a single extracted.json file containing the ExtractedPackable structure
  • AssetStore removed: Replaced with PackableStore in packable.py for streamlined asset management
  • Constant changes: DATA_FILE and SCHEMA_FILE constants replaced with EXTRACTED_FILE

New Features

JSON Schema Hints for Reconstruction

  • Added x-base and x-module extension properties to JSON schemas
  • x-base indicates the base class type: 'Packable', 'Mesh', or 'BaseModel'
  • x-module stores the fully qualified class module path for proper reconstruction
  • Enables type-safe deserialization without explicit class references

VTK Export Support (Python)

  • New to_pyvista() method converts Mesh to PyVista UnstructuredGrid
  • New save_vtk() method exports meshes to VTK formats (.vtk, .vtu, .ply, .stl)
  • Requires pyvista (available in dev dependencies)

Improved Mesh.combine() Method

  • Now a classmethod supporting subclass instantiation
  • Preserves extra fields from subclasses when combining meshes
  • Returns the correct subclass type instead of base Mesh

Changes by Area

Area Files Changed Summary
Core Python packable.py, mesh.py ExtractedPackable structure, x-base hints, VTK export
Core TypeScript packable.ts, mesh.ts, lazy-model.ts ExtractedPackable support, x-base hints
Constants constants.py, constants.ts New EXTRACTED_FILE constant
JSON Schema json_schema.py, json-schema.ts x-base and x-module properties
Tests 6 test files Updated for new format, added dynamic model tests
Documentation README.md (both) Updated usage examples

Files Changed

26 files changed, 1017 insertions(+), 746 deletions(-)

Testing

  • Updated existing tests for new ExtractedPackable format
  • Added comprehensive test_dynamic_model_base.py for reconstruction testing
  • Backward compatibility verified in asset handling tests

…dling

- Updated Mesh class to support new decoding format using metadata/data.json, metadata/schema.json, and assets/{checksum}.bin.
- Removed deprecated interfaces and methods related to mesh size and custom field configurations.
- Enhanced marker handling in MeshData and Mesh class, including renaming and restructuring of marker-related properties.
- Refactored Packable class to align with new data structure, including removal of legacy metadata loading and custom field decoding.
- Introduced SchemaUtils for resolving $ref references and handling JSON Schema during deserialization.
- Improved error handling for missing assets and references.
- Added utility functions for extracting checksums from data objects.
…nd asset management

- Introduced `PackableStore` to manage asset storage and extracted data paths.
- Updated `Packable` and `Mesh` classes to include JSON schema hints (`x-base`, `x-module`) for better reconstruction.
- Modified extraction and reconstruction methods to utilize the new `ExtractedPackable` structure.
- Simplified asset handling during save/load operations, ensuring deduplication and correct file paths.
- Enhanced tests to cover new functionality and ensure backward compatibility with existing features.
@afshawnlotfi afshawnlotfi changed the title Format overhaul typescript Format Overhaul - Enhanced JSON Schema Support and Asset Management Feb 13, 2026
@afshawnlotfi afshawnlotfi merged commit de26017 into main Feb 13, 2026
2 of 4 checks passed
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.

1 participant

Comments