Lutaml::Model is a modelling library that offers a superset of features that Shale provides. Its API is similar but has several key differences.
A migration guide from Shale to Lutaml::Model is provided at Migrating from Shale to Lutaml::Model.
| Feature | Lutaml::Model | Shale | Notes |
|---|---|---|---|
Data model definition | 3 types:
| 2 types:
| |
Value types |
|
| Lutaml::Model supports additional value types |
Configuration |
|
| Lutaml::Model uses a configuration block to set the serialization adapters. |
Custom serialization methods |
|
| Lutaml::Model uses the |
Serialization formats | XML, YAML, JSON, TOML | XML, YAML, JSON, TOML, CSV | Lutaml::Model does not support CSV. |
Validation | Supports collection range, fixed values, and custom validation | Requires implementation | |
Adapter support | XML (Nokogiri, Ox, Oga), YAML, JSON (JSON, MultiJson), TOML (Toml-rb, Tomlib) | XML (Nokogiri, Ox), YAML, JSON (JSON, MultiJson), TOML (Toml-rb, Tomlib), CSV | Lutaml::Model does not support CSV. |
XML features | |||
XML default namespace | Yes. Supports | No. Only supports | |
XML mixed content support | Yes. Supports mixed content through dedicated | No. Shale’s | |
XML namespace inheritance | Yes. Supports the | No. | |
Support for | Yes. Automatically supports the | Requires manual specification on every XML element that uses it. | |
Compiling XML Schema to classes | Yes. Using
| Yes, provides only an array of classes and doesn’t support simple types with restrictions. | |
Attribute features | |||
Attribute delegation |
|
| |
Enumerations | Yes. Supports enumerations as value types through the | No. | Lutaml::Model supports enumerations as value types. |
Attribute extraction | Yes. Supports attribute extraction from key-value data models. | No. | Lutaml::Model supports attribute extraction from key-value data models. |
Register | Yes. Supports three types of registers with different functionalities. | Supports | Lutaml::Model registers both |
Migration path
If you’re migrating from Shale to Lutaml::Model:
-
Read the Migration Guide
-
Update adapter configuration syntax
-
Change
:receiverto:delegatein delegations -
Consider using new features like XML namespaces
-
Test thoroughly with your specific use cases
Key advantages of Lutaml::Model
-
XML namespace support: Full W3C namespace implementation
-
Schema import/export: XSD, JSON Schema, YAML Schema
-
Built-in validation: Collection ranges, enumerations, patterns
-
Type system: Custom types with format-specific serialization
-
Polymorphism: Flexible polymorphic attribute support
-
Value transformations: Multiple transformation strategies