lutaml-model 0.8.33 → 0.8.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +5 -0
  4. data/Gemfile +4 -0
  5. data/README.adoc +39 -0
  6. data/docs/conversion_caching.adoc +143 -0
  7. data/lib/compat/opal/lutaml_model_boot.rb +15 -0
  8. data/lib/lutaml/model/attribute.rb +95 -4
  9. data/lib/lutaml/model/config.rb +13 -0
  10. data/lib/lutaml/model/configuration.rb +23 -0
  11. data/lib/lutaml/model/error/fraction_digits_error.rb +20 -0
  12. data/lib/lutaml/model/error/length_error.rb +19 -0
  13. data/lib/lutaml/model/error/max_exclusive_error.rb +19 -0
  14. data/lib/lutaml/model/error/max_inclusive_error.rb +20 -0
  15. data/lib/lutaml/model/error/max_length_error.rb +20 -0
  16. data/lib/lutaml/model/error/min_exclusive_error.rb +19 -0
  17. data/lib/lutaml/model/error/min_inclusive_error.rb +20 -0
  18. data/lib/lutaml/model/error/min_length_error.rb +20 -0
  19. data/lib/lutaml/model/error/restriction_error.rb +8 -0
  20. data/lib/lutaml/model/error/total_digits_error.rb +20 -0
  21. data/lib/lutaml/model/error/type/max_exclusive_error.rb +20 -0
  22. data/lib/lutaml/model/error/type/min_exclusive_error.rb +20 -0
  23. data/lib/lutaml/model/error/type.rb +2 -0
  24. data/lib/lutaml/model/register.rb +12 -5
  25. data/lib/lutaml/model/restriction_validation.rb +437 -0
  26. data/lib/lutaml/model/schema/definitions/restricted_type.rb +4 -2
  27. data/lib/lutaml/model/schema/renderers/restricted_type.rb +134 -4
  28. data/lib/lutaml/model/schema/rng_compiler/define_classifier.rb +3 -0
  29. data/lib/lutaml/model/schema/rng_compiler/rng_helpers.rb +9 -1
  30. data/lib/lutaml/model/schema/rng_compiler/value_type_resolver.rb +2 -0
  31. data/lib/lutaml/model/schema/templates.rb +2 -0
  32. data/lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb +39 -7
  33. data/lib/lutaml/model/schema/xml_compiler/supported_data_types.rb +3 -0
  34. data/lib/lutaml/model/serialize/attribute_definition.rb +18 -7
  35. data/lib/lutaml/model/serialize/builder.rb +4 -5
  36. data/lib/lutaml/model/serialize/conversion_caching.rb +124 -0
  37. data/lib/lutaml/model/serialize/enum_handling.rb +50 -11
  38. data/lib/lutaml/model/serialize/format_conversion.rb +46 -38
  39. data/lib/lutaml/model/serialize/initialization.rb +4 -2
  40. data/lib/lutaml/model/serialize.rb +61 -0
  41. data/lib/lutaml/model/services/type/validator.rb +23 -0
  42. data/lib/lutaml/model/transformation_registry.rb +13 -7
  43. data/lib/lutaml/model/type/string.rb +28 -3
  44. data/lib/lutaml/model/type/value.rb +231 -0
  45. data/lib/lutaml/model/type.rb +2 -0
  46. data/lib/lutaml/model/validation.rb +2 -1
  47. data/lib/lutaml/model/version.rb +1 -1
  48. data/lib/lutaml/model.rb +16 -0
  49. data/lib/lutaml/xml/adapter_element.rb +17 -4
  50. data/lib/lutaml/xml/model_transform.rb +4 -1
  51. data/lib/lutaml/xml/schema/xsd/max_exclusive.rb +1 -1
  52. data/lib/lutaml/xml/schema/xsd/min_exclusive.rb +1 -1
  53. data/lib/lutaml/xml/schema/xsd_schema.rb +183 -11
  54. data/lib/lutaml/xml/transformation/order_reconciler.rb +267 -0
  55. data/lib/lutaml/xml/transformation/ordered_applier.rb +80 -122
  56. data/lib/lutaml/xml/transformation/rule_compiler.rb +2 -0
  57. data/lib/lutaml/xml/transformation.rb +2 -0
  58. data/lib/lutaml/xml/transformation_support.rb +1 -0
  59. data/spec/benchmarks/xml_parsing_benchmark_spec.rb +70 -0
  60. data/spec/fixtures/xml/restriction_facets.xsd +46 -0
  61. data/spec/lutaml/model/attribute_restriction_spec.rb +472 -0
  62. data/spec/lutaml/model/attribute_spec.rb +7 -2
  63. data/spec/lutaml/model/collection_reader_liveness_spec.rb +516 -0
  64. data/spec/lutaml/model/conversion_caching_spec.rb +280 -0
  65. data/spec/lutaml/model/lazy_collection_spec.rb +28 -3
  66. data/spec/lutaml/model/parsed_model_mutation_spec.rb +486 -0
  67. data/spec/lutaml/model/phantom_value_spec.rb +799 -0
  68. data/spec/lutaml/model/schema/renderers/restricted_type_spec.rb +1 -0
  69. data/spec/lutaml/model/schema/xsd_schema_spec.rb +340 -695
  70. data/spec/lutaml/model/serialize_perf_guard_spec.rb +53 -1
  71. data/spec/lutaml/model/type_digit_facet_spec.rb +229 -0
  72. data/spec/lutaml/model/type_facet_restriction_spec.rb +667 -0
  73. data/spec/lutaml/model/type_white_space_facet_spec.rb +132 -0
  74. data/spec/lutaml/xml/schema/compiler_spec.rb +302 -0
  75. data/spec/lutaml/xml/schema/facet_round_trip_spec.rb +153 -0
  76. metadata +28 -1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.33
4
+ version: 0.8.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -289,6 +289,7 @@ files:
289
289
  - docs/bugreports/BUGREPORT_element_order_render_empty.md
290
290
  - docs/cli_compare.adoc
291
291
  - docs/collection_validation.adoc
292
+ - docs/conversion_caching.adoc
292
293
  - docs/index.adoc
293
294
  - docs/key_value_data_model.adoc
294
295
  - docs/model_transforms.adoc
@@ -431,6 +432,7 @@ files:
431
432
  - lib/lutaml/model/error/collection_true_missing_error.rb
432
433
  - lib/lutaml/model/error/element_count_out_of_range_error.rb
433
434
  - lib/lutaml/model/error/format_adapter_not_specified_error.rb
435
+ - lib/lutaml/model/error/fraction_digits_error.rb
434
436
  - lib/lutaml/model/error/import_model_with_root_error.rb
435
437
  - lib/lutaml/model/error/incorrect_mapping_argument_error.rb
436
438
  - lib/lutaml/model/error/incorrect_sequence_error.rb
@@ -440,12 +442,19 @@ files:
440
442
  - lib/lutaml/model/error/invalid_choice_range_error.rb
441
443
  - lib/lutaml/model/error/invalid_format_error.rb
442
444
  - lib/lutaml/model/error/invalid_value_error.rb
445
+ - lib/lutaml/model/error/length_error.rb
443
446
  - lib/lutaml/model/error/liquid_class_not_found_error.rb
444
447
  - lib/lutaml/model/error/liquid_drop_already_registered_error.rb
445
448
  - lib/lutaml/model/error/liquid_not_enabled_error.rb
446
449
  - lib/lutaml/model/error/mapping_already_exists_error.rb
447
450
  - lib/lutaml/model/error/mapping_attribute_missing_error.rb
448
451
  - lib/lutaml/model/error/mapping_attribute_type_error.rb
452
+ - lib/lutaml/model/error/max_exclusive_error.rb
453
+ - lib/lutaml/model/error/max_inclusive_error.rb
454
+ - lib/lutaml/model/error/max_length_error.rb
455
+ - lib/lutaml/model/error/min_exclusive_error.rb
456
+ - lib/lutaml/model/error/min_inclusive_error.rb
457
+ - lib/lutaml/model/error/min_length_error.rb
449
458
  - lib/lutaml/model/error/mixed_content_collection_error.rb
450
459
  - lib/lutaml/model/error/multiple_mappings_error.rb
451
460
  - lib/lutaml/model/error/no_attributes_defined_liquid_error.rb
@@ -457,15 +466,19 @@ files:
457
466
  - lib/lutaml/model/error/polymorphic_error.rb
458
467
  - lib/lutaml/model/error/register/not_registrable_class_error.rb
459
468
  - lib/lutaml/model/error/required_attribute_missing_error.rb
469
+ - lib/lutaml/model/error/restriction_error.rb
460
470
  - lib/lutaml/model/error/reverse_transform_block_not_defined_error.rb
461
471
  - lib/lutaml/model/error/reverse_transformation_declaration_error.rb
462
472
  - lib/lutaml/model/error/sorting_configuration_conflict_error.rb
473
+ - lib/lutaml/model/error/total_digits_error.rb
463
474
  - lib/lutaml/model/error/transform_block_not_defined_error.rb
464
475
  - lib/lutaml/model/error/type.rb
465
476
  - lib/lutaml/model/error/type/invalid_value_error.rb
466
477
  - lib/lutaml/model/error/type/max_bound_error.rb
478
+ - lib/lutaml/model/error/type/max_exclusive_error.rb
467
479
  - lib/lutaml/model/error/type/max_length_error.rb
468
480
  - lib/lutaml/model/error/type/min_bound_error.rb
481
+ - lib/lutaml/model/error/type/min_exclusive_error.rb
469
482
  - lib/lutaml/model/error/type/min_length_error.rb
470
483
  - lib/lutaml/model/error/type/pattern_not_matched_error.rb
471
484
  - lib/lutaml/model/error/type_error.rb
@@ -509,6 +522,7 @@ files:
509
522
  - lib/lutaml/model/register/namespace_binding.rb
510
523
  - lib/lutaml/model/registrable.rb
511
524
  - lib/lutaml/model/render_policy.rb
525
+ - lib/lutaml/model/restriction_validation.rb
512
526
  - lib/lutaml/model/runtime_compatibility.rb
513
527
  - lib/lutaml/model/schema.rb
514
528
  - lib/lutaml/model/schema/base_schema.rb
@@ -588,6 +602,7 @@ files:
588
602
  - lib/lutaml/model/serialize.rb
589
603
  - lib/lutaml/model/serialize/attribute_definition.rb
590
604
  - lib/lutaml/model/serialize/builder.rb
605
+ - lib/lutaml/model/serialize/conversion_caching.rb
591
606
  - lib/lutaml/model/serialize/deserialization_context.rb
592
607
  - lib/lutaml/model/serialize/enum_handling.rb
593
608
  - lib/lutaml/model/serialize/format_conversion.rb
@@ -887,6 +902,7 @@ files:
887
902
  - lib/lutaml/xml/transformation.rb
888
903
  - lib/lutaml/xml/transformation/custom_method_wrapper.rb
889
904
  - lib/lutaml/xml/transformation/element_builder.rb
905
+ - lib/lutaml/xml/transformation/order_reconciler.rb
890
906
  - lib/lutaml/xml/transformation/ordered_applier.rb
891
907
  - lib/lutaml/xml/transformation/rule_applier.rb
892
908
  - lib/lutaml/xml/transformation/rule_compiler.rb
@@ -955,6 +971,7 @@ files:
955
971
  - sig/lutaml/model.rbs
956
972
  - spec/address_person_spec.rb
957
973
  - spec/address_spec.rb
974
+ - spec/benchmarks/xml_parsing_benchmark_spec.rb
958
975
  - spec/ceramic_spec.rb
959
976
  - spec/fixtures/address.rb
960
977
  - spec/fixtures/ceramic.rb
@@ -973,6 +990,7 @@ files:
973
990
  - spec/fixtures/xml/latin_encoding.xml
974
991
  - spec/fixtures/xml/math_document_schema.xsd
975
992
  - spec/fixtures/xml/product_catalog.xsd
993
+ - spec/fixtures/xml/restriction_facets.xsd
976
994
  - spec/fixtures/xml/schema/rnc/address_book.rnc
977
995
  - spec/fixtures/xml/schema/rnc/book_features.rnc
978
996
  - spec/fixtures/xml/schema/rnc/includes/book.rnc
@@ -1671,6 +1689,7 @@ files:
1671
1689
  - spec/lutaml/model/attribute_collection_spec.rb
1672
1690
  - spec/lutaml/model/attribute_default_cache_spec.rb
1673
1691
  - spec/lutaml/model/attribute_form_default_spec.rb
1692
+ - spec/lutaml/model/attribute_restriction_spec.rb
1674
1693
  - spec/lutaml/model/attribute_spec.rb
1675
1694
  - spec/lutaml/model/boot_manifest_spec.rb
1676
1695
  - spec/lutaml/model/cached_type_resolver_spec.rb
@@ -1681,6 +1700,7 @@ files:
1681
1700
  - spec/lutaml/model/cli_spec.rb
1682
1701
  - spec/lutaml/model/collection_index_spec.rb
1683
1702
  - spec/lutaml/model/collection_mutation_spec.rb
1703
+ - spec/lutaml/model/collection_reader_liveness_spec.rb
1684
1704
  - spec/lutaml/model/collection_register_spec.rb
1685
1705
  - spec/lutaml/model/collection_single_value_coercion_spec.rb
1686
1706
  - spec/lutaml/model/collection_spec.rb
@@ -1690,6 +1710,7 @@ files:
1690
1710
  - spec/lutaml/model/compiled_rule_spec.rb
1691
1711
  - spec/lutaml/model/consolidation_spec.rb
1692
1712
  - spec/lutaml/model/context_registry_spec.rb
1713
+ - spec/lutaml/model/conversion_caching_spec.rb
1693
1714
  - spec/lutaml/model/custom_bibtex_adapter_spec.rb
1694
1715
  - spec/lutaml/model/custom_collection_spec.rb
1695
1716
  - spec/lutaml/model/custom_from_empty_values_spec.rb
@@ -1736,6 +1757,8 @@ files:
1736
1757
  - spec/lutaml/model/opal_smoke_spec.rb
1737
1758
  - spec/lutaml/model/optimization_spec.rb
1738
1759
  - spec/lutaml/model/ordered_content_spec.rb
1760
+ - spec/lutaml/model/parsed_model_mutation_spec.rb
1761
+ - spec/lutaml/model/phantom_value_spec.rb
1739
1762
  - spec/lutaml/model/polymorphic_spec.rb
1740
1763
  - spec/lutaml/model/processing_instruction_spec.rb
1741
1764
  - spec/lutaml/model/raw_adapter_require_spec.rb
@@ -1795,10 +1818,13 @@ files:
1795
1818
  - spec/lutaml/model/type/uri_spec.rb
1796
1819
  - spec/lutaml/model/type/value_xml_mapping_spec.rb
1797
1820
  - spec/lutaml/model/type_context_spec.rb
1821
+ - spec/lutaml/model/type_digit_facet_spec.rb
1822
+ - spec/lutaml/model/type_facet_restriction_spec.rb
1798
1823
  - spec/lutaml/model/type_registry_spec.rb
1799
1824
  - spec/lutaml/model/type_resolver_spec.rb
1800
1825
  - spec/lutaml/model/type_spec.rb
1801
1826
  - spec/lutaml/model/type_substitution_spec.rb
1827
+ - spec/lutaml/model/type_white_space_facet_spec.rb
1802
1828
  - spec/lutaml/model/uninitialized_class_deep_dup_spec.rb
1803
1829
  - spec/lutaml/model/uninitialized_class_spec.rb
1804
1830
  - spec/lutaml/model/union_attribute_spec.rb
@@ -1929,6 +1955,7 @@ files:
1929
1955
  - spec/lutaml/xml/reused_elements_namespace_spec.rb
1930
1956
  - spec/lutaml/xml/root_mappings/nested_child_mappings_spec.rb
1931
1957
  - spec/lutaml/xml/schema/compiler_spec.rb
1958
+ - spec/lutaml/xml/schema/facet_round_trip_spec.rb
1932
1959
  - spec/lutaml/xml/schema/rnc_compiler_spec.rb
1933
1960
  - spec/lutaml/xml/schema/rng_compiler_spec.rb
1934
1961
  - spec/lutaml/xml/schema/xsd/errors/error_context_spec.rb