lutaml-model 0.8.17 → 0.8.18

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 (192) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/downstream-performance.yml +27 -1
  3. data/.github/workflows/js-pr-check.yml +102 -0
  4. data/.github/workflows/js-sync.yml +51 -0
  5. data/.github/workflows/opal.yml +26 -6
  6. data/.github/workflows/performance.yml +32 -7
  7. data/.github/workflows/rake.yml +78 -32
  8. data/.gitmodules +6 -0
  9. data/.rubocop_todo.yml +8 -0
  10. data/Gemfile +16 -1
  11. data/README.adoc +267 -0
  12. data/Rakefile +166 -4
  13. data/docs/_guides/schema-import.adoc +42 -0
  14. data/docs/_guides/xml-mapping.adoc +21 -0
  15. data/docs/_pages/validation.adoc +65 -0
  16. data/lib/compat/opal/generate_boot.rb +123 -0
  17. data/lib/compat/opal/js_bundle_entry.rb +42 -0
  18. data/lib/compat/opal/lutaml_model_boot.rb +497 -0
  19. data/lib/compat/opal/moxml_boot.rb +68 -0
  20. data/lib/compat/opal/yaml_compat.rb +32 -0
  21. data/lib/lutaml/json.rb +1 -1
  22. data/lib/lutaml/key_value/transform.rb +3 -8
  23. data/lib/lutaml/key_value/transformation/value_serializer.rb +14 -1
  24. data/lib/lutaml/key_value/transformation.rb +17 -5
  25. data/lib/lutaml/model/adapter_resolver.rb +2 -2
  26. data/lib/lutaml/model/attribute.rb +88 -11
  27. data/lib/lutaml/model/cached_type_resolver.rb +1 -1
  28. data/lib/lutaml/model/error/union_schema_unsupported_error.rb +11 -0
  29. data/lib/lutaml/model/global_context.rb +11 -8
  30. data/lib/lutaml/model/instrumentation.rb +2 -2
  31. data/lib/lutaml/model/mapping/mapping_rule.rb +0 -6
  32. data/lib/lutaml/model/register.rb +2 -2
  33. data/lib/lutaml/model/runtime_compatibility.rb +50 -0
  34. data/lib/lutaml/model/schema/class_loader.rb +58 -0
  35. data/lib/lutaml/model/schema/compiled_output.rb +83 -0
  36. data/lib/lutaml/model/schema/definitions/attribute.rb +32 -0
  37. data/lib/lutaml/model/schema/definitions/choice.rb +20 -0
  38. data/lib/lutaml/model/schema/definitions/facet.rb +40 -0
  39. data/lib/lutaml/model/schema/definitions/group_import.rb +22 -0
  40. data/lib/lutaml/model/schema/definitions/member_walk.rb +33 -0
  41. data/lib/lutaml/model/schema/definitions/model.rb +40 -0
  42. data/lib/lutaml/model/schema/definitions/namespace.rb +23 -0
  43. data/lib/lutaml/model/schema/definitions/restricted_type.rb +30 -0
  44. data/lib/lutaml/model/schema/definitions/sequence.rb +19 -0
  45. data/lib/lutaml/model/schema/definitions/simple_content.rb +22 -0
  46. data/lib/lutaml/model/schema/definitions/transform_facet.rb +21 -0
  47. data/lib/lutaml/model/schema/definitions/type_ref.rb +20 -0
  48. data/lib/lutaml/model/schema/definitions/union_type.rb +28 -0
  49. data/lib/lutaml/model/schema/definitions/xml_root.rb +20 -0
  50. data/lib/lutaml/model/schema/definitions.rb +24 -0
  51. data/lib/lutaml/model/schema/file_writer.rb +70 -0
  52. data/lib/lutaml/model/schema/generator/definitions_collection.rb +16 -2
  53. data/lib/lutaml/model/schema/generator/property.rb +21 -4
  54. data/lib/lutaml/model/schema/module_nesting.rb +31 -0
  55. data/lib/lutaml/model/schema/namespace_naming.rb +46 -0
  56. data/lib/lutaml/model/schema/registry_generator.rb +115 -0
  57. data/lib/lutaml/model/schema/renderers/base.rb +40 -0
  58. data/lib/lutaml/model/schema/renderers/mappings.rb +72 -0
  59. data/lib/lutaml/model/schema/renderers/member_decls.rb +115 -0
  60. data/lib/lutaml/model/schema/renderers/model.rb +121 -0
  61. data/lib/lutaml/model/schema/renderers/namespace.rb +30 -0
  62. data/lib/lutaml/model/schema/renderers/registration.rb +64 -0
  63. data/lib/lutaml/model/schema/renderers/required_files_calculator.rb +93 -0
  64. data/lib/lutaml/model/schema/renderers/restricted_type.rb +88 -0
  65. data/lib/lutaml/model/schema/renderers/union.rb +83 -0
  66. data/lib/lutaml/model/schema/renderers.rb +19 -0
  67. data/lib/lutaml/model/schema/rnc_compiler/source_resolver.rb +47 -0
  68. data/lib/lutaml/model/schema/rnc_compiler.rb +62 -0
  69. data/lib/lutaml/model/schema/rng_compiler/define_classifier.rb +91 -0
  70. data/lib/lutaml/model/schema/rng_compiler/element_visitor.rb +392 -0
  71. data/lib/lutaml/model/schema/rng_compiler/member_collector.rb +30 -0
  72. data/lib/lutaml/model/schema/rng_compiler/rng_helpers.rb +152 -0
  73. data/lib/lutaml/model/schema/rng_compiler/value_type_resolver.rb +125 -0
  74. data/lib/lutaml/model/schema/rng_compiler.rb +220 -0
  75. data/lib/lutaml/model/schema/templates.rb +162 -0
  76. data/lib/lutaml/model/schema/xml_compiler/element_order.rb +41 -0
  77. data/lib/lutaml/model/schema/xml_compiler/registry_generator.rb +31 -107
  78. data/lib/lutaml/model/schema/xml_compiler/spec_builder/complex_types.rb +191 -0
  79. data/lib/lutaml/model/schema/xml_compiler/spec_builder/members.rb +216 -0
  80. data/lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb +153 -0
  81. data/lib/lutaml/model/schema/xml_compiler/spec_builder.rb +167 -0
  82. data/lib/lutaml/model/schema/xml_compiler/supported_data_types.rb +87 -0
  83. data/lib/lutaml/model/schema/xml_compiler.rb +38 -517
  84. data/lib/lutaml/model/schema.rb +19 -0
  85. data/lib/lutaml/model/serialize/attribute_definition.rb +14 -2
  86. data/lib/lutaml/model/serialize/builder.rb +15 -2
  87. data/lib/lutaml/model/serialize/value_mapping.rb +9 -57
  88. data/lib/lutaml/model/serialize.rb +6 -9
  89. data/lib/lutaml/model/services/rule_value_extractor.rb +2 -3
  90. data/lib/lutaml/model/services.rb +0 -2
  91. data/lib/lutaml/model/store.rb +2 -1
  92. data/lib/lutaml/model/toml.rb +1 -1
  93. data/lib/lutaml/model/transform.rb +17 -39
  94. data/lib/lutaml/model/transformation_registry.rb +1 -1
  95. data/lib/lutaml/model/type.rb +1 -0
  96. data/lib/lutaml/model/union.rb +320 -0
  97. data/lib/lutaml/model/utils.rb +6 -0
  98. data/lib/lutaml/model/validation.rb +1 -4
  99. data/lib/lutaml/model/version.rb +1 -1
  100. data/lib/lutaml/model.rb +18 -0
  101. data/lib/lutaml/toml.rb +1 -1
  102. data/lib/lutaml/xml/adapter.rb +1 -1
  103. data/lib/lutaml/xml/adapter_loader.rb +1 -1
  104. data/lib/lutaml/xml/builder/base.rb +1 -1
  105. data/lib/lutaml/xml/builder.rb +1 -1
  106. data/lib/lutaml/xml/error/schema_validation_error.rb +25 -0
  107. data/lib/lutaml/xml/model_transform.rb +5 -1
  108. data/lib/lutaml/xml/schema/relaxng_schema.rb +5 -0
  109. data/lib/lutaml/xml/schema/xsd_schema.rb +4 -0
  110. data/lib/lutaml/xml/serialization/format_conversion.rb +48 -0
  111. data/lib/lutaml/xml/serialization/instance_methods.rb +13 -0
  112. data/lib/lutaml/xml/transformation/element_builder.rb +21 -8
  113. data/lib/lutaml/xml/transformation/ordered_applier.rb +6 -0
  114. data/lib/lutaml/xml/xsd_validator.rb +66 -0
  115. data/lib/lutaml/xml.rb +53 -12
  116. data/lutaml-model.gemspec +4 -2
  117. data/spec/fixtures/xml/schema/rnc/address_book.rnc +15 -0
  118. data/spec/fixtures/xml/schema/rnc/book_features.rnc +18 -0
  119. data/spec/fixtures/xml/schema/rnc/includes/book.rnc +6 -0
  120. data/spec/fixtures/xml/schema/rnc/includes/circular_a.rnc +8 -0
  121. data/spec/fixtures/xml/schema/rnc/includes/circular_b.rnc +8 -0
  122. data/spec/fixtures/xml/schema/rnc/includes/library.rnc +8 -0
  123. data/spec/fixtures/xml/schema/rng/address_book.rng +16 -0
  124. data/spec/fixtures/xml/schema/rng/book.rng +27 -0
  125. data/spec/fixtures/xml/schema/rng/fixed_value.rng +11 -0
  126. data/spec/fixtures/xml/schema/rng/fragment_in_choice.rng +30 -0
  127. data/spec/fixtures/xml/schema/rng/full_name.rng +39 -0
  128. data/spec/fixtures/xml/schema/rng/integer_range.rng +32 -0
  129. data/spec/fixtures/xml/schema/rng/list_type.rng +12 -0
  130. data/spec/fixtures/xml/schema/rng/namespaced.rng +9 -0
  131. data/spec/fixtures/xml/schema/rng/paragraph.rng +13 -0
  132. data/spec/fixtures/xml/schema/rng/person.rng +23 -0
  133. data/spec/fixtures/xml/schema/rng/union.rng +14 -0
  134. data/spec/fixtures/xml/validate_xml_with_address.xsd +13 -0
  135. data/spec/fixtures/xml/validate_xml_with_contact.xsd +11 -0
  136. data/spec/fixtures/xml/validate_xml_with_person.xsd +11 -0
  137. data/spec/fixtures/xml/validate_xml_with_person_strict.xsd +17 -0
  138. data/spec/fixtures/xml/validate_xml_with_product.xsd +37 -0
  139. data/spec/lutaml/model/attribute_apply_value_map_spec.rb +134 -0
  140. data/spec/lutaml/model/attribute_spec.rb +169 -12
  141. data/spec/lutaml/model/boot_manifest_spec.rb +30 -0
  142. data/spec/lutaml/model/collection_spec.rb +18 -0
  143. data/spec/lutaml/model/mixed_content_spec.rb +171 -0
  144. data/spec/lutaml/model/opal_smoke_spec.rb +67 -2
  145. data/spec/lutaml/model/ordered_content_spec.rb +30 -0
  146. data/spec/lutaml/model/raw_element_spec.rb +125 -0
  147. data/spec/lutaml/model/rule_value_extractor_spec.rb +7 -14
  148. data/spec/lutaml/model/runtime_compatibility_spec.rb +25 -0
  149. data/spec/lutaml/model/schema/renderers/model_spec.rb +149 -0
  150. data/spec/lutaml/model/schema/renderers/namespace_spec.rb +36 -0
  151. data/spec/lutaml/model/schema/renderers/restricted_type_spec.rb +75 -0
  152. data/spec/lutaml/model/schema/renderers/union_spec.rb +58 -0
  153. data/spec/lutaml/model/transform_apply_value_map_spec.rb +64 -0
  154. data/spec/lutaml/model/union_attribute_spec.rb +658 -0
  155. data/spec/lutaml/model/union_spec.rb +257 -0
  156. data/spec/lutaml/model/utils_spec.rb +14 -0
  157. data/spec/lutaml/xml/opal_xml_spec.rb +22 -20
  158. data/spec/lutaml/xml/schema/compiler_spec.rb +21 -4
  159. data/spec/lutaml/xml/schema/rnc_compiler_spec.rb +404 -0
  160. data/spec/lutaml/xml/schema/rng_compiler_spec.rb +893 -0
  161. data/spec/lutaml/xml/validate_xml_with_constructs_spec.rb +222 -0
  162. data/spec/lutaml/xml/validate_xml_with_spec.rb +186 -0
  163. data/spec/spec_helper.rb +28 -11
  164. data/spec/support/opal.rb +5 -2
  165. metadata +97 -31
  166. data/lib/lutaml/model/schema/xml_compiler/attribute.rb +0 -106
  167. data/lib/lutaml/model/schema/xml_compiler/attribute_group.rb +0 -47
  168. data/lib/lutaml/model/schema/xml_compiler/choice.rb +0 -67
  169. data/lib/lutaml/model/schema/xml_compiler/complex_content.rb +0 -27
  170. data/lib/lutaml/model/schema/xml_compiler/complex_content_restriction.rb +0 -34
  171. data/lib/lutaml/model/schema/xml_compiler/complex_type.rb +0 -173
  172. data/lib/lutaml/model/schema/xml_compiler/element.rb +0 -121
  173. data/lib/lutaml/model/schema/xml_compiler/group.rb +0 -113
  174. data/lib/lutaml/model/schema/xml_compiler/restriction.rb +0 -104
  175. data/lib/lutaml/model/schema/xml_compiler/sequence.rb +0 -52
  176. data/lib/lutaml/model/schema/xml_compiler/simple_content.rb +0 -40
  177. data/lib/lutaml/model/schema/xml_compiler/simple_type.rb +0 -265
  178. data/lib/lutaml/model/schema/xml_compiler/xml_namespace_class.rb +0 -110
  179. data/lib/lutaml/model/services/default_value_resolver.rb +0 -60
  180. data/spec/lutaml/model/services/default_value_resolver_spec.rb +0 -162
  181. data/spec/lutaml/xml/schema/compiler/attribute_group_spec.rb +0 -71
  182. data/spec/lutaml/xml/schema/compiler/attribute_spec.rb +0 -67
  183. data/spec/lutaml/xml/schema/compiler/choice_spec.rb +0 -74
  184. data/spec/lutaml/xml/schema/compiler/complex_content_restriction_spec.rb +0 -60
  185. data/spec/lutaml/xml/schema/compiler/complex_content_spec.rb +0 -41
  186. data/spec/lutaml/xml/schema/compiler/complex_type_spec.rb +0 -202
  187. data/spec/lutaml/xml/schema/compiler/element_spec.rb +0 -68
  188. data/spec/lutaml/xml/schema/compiler/group_spec.rb +0 -90
  189. data/spec/lutaml/xml/schema/compiler/restriction_spec.rb +0 -77
  190. data/spec/lutaml/xml/schema/compiler/sequence_spec.rb +0 -65
  191. data/spec/lutaml/xml/schema/compiler/simple_content_spec.rb +0 -61
  192. data/spec/lutaml/xml/schema/compiler/simple_type_spec.rb +0 -184
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.17
4
+ version: 0.8.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-28 00:00:00.000000000 Z
11
+ date: 2026-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 0.1.23
95
+ version: 0.1.25
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 0.1.23
102
+ version: 0.1.25
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: ostruct
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -158,11 +158,14 @@ files:
158
158
  - ".github/workflows/dependent-tests.yml"
159
159
  - ".github/workflows/docs.yml"
160
160
  - ".github/workflows/downstream-performance.yml"
161
+ - ".github/workflows/js-pr-check.yml"
162
+ - ".github/workflows/js-sync.yml"
161
163
  - ".github/workflows/opal.yml"
162
164
  - ".github/workflows/performance.yml"
163
165
  - ".github/workflows/rake.yml"
164
166
  - ".github/workflows/release.yml"
165
167
  - ".gitignore"
168
+ - ".gitmodules"
166
169
  - ".irbrc"
167
170
  - ".pryrc"
168
171
  - ".rspec"
@@ -293,6 +296,11 @@ files:
293
296
  - exe/lutaml-model
294
297
  - flake.lock
295
298
  - flake.nix
299
+ - lib/compat/opal/generate_boot.rb
300
+ - lib/compat/opal/js_bundle_entry.rb
301
+ - lib/compat/opal/lutaml_model_boot.rb
302
+ - lib/compat/opal/moxml_boot.rb
303
+ - lib/compat/opal/yaml_compat.rb
296
304
  - lib/lutaml/hash_format.rb
297
305
  - lib/lutaml/hash_format/adapter.rb
298
306
  - lib/lutaml/hash_format/adapter/document.rb
@@ -454,6 +462,7 @@ files:
454
462
  - lib/lutaml/model/error/type_only_mapping_error.rb
455
463
  - lib/lutaml/model/error/type_only_namespace_error.rb
456
464
  - lib/lutaml/model/error/undefined_attribute_error.rb
465
+ - lib/lutaml/model/error/union_schema_unsupported_error.rb
457
466
  - lib/lutaml/model/error/unknown_adapter_type_error.rb
458
467
  - lib/lutaml/model/error/unknown_sequence_mapping_error.rb
459
468
  - lib/lutaml/model/error/unknown_type_error.rb
@@ -492,11 +501,29 @@ files:
492
501
  - lib/lutaml/model/runtime_compatibility.rb
493
502
  - lib/lutaml/model/schema.rb
494
503
  - lib/lutaml/model/schema/base_schema.rb
504
+ - lib/lutaml/model/schema/class_loader.rb
505
+ - lib/lutaml/model/schema/compiled_output.rb
495
506
  - lib/lutaml/model/schema/decorators.rb
496
507
  - lib/lutaml/model/schema/decorators/attribute.rb
497
508
  - lib/lutaml/model/schema/decorators/choices.rb
498
509
  - lib/lutaml/model/schema/decorators/class_definition.rb
499
510
  - lib/lutaml/model/schema/decorators/definition_collection.rb
511
+ - lib/lutaml/model/schema/definitions.rb
512
+ - lib/lutaml/model/schema/definitions/attribute.rb
513
+ - lib/lutaml/model/schema/definitions/choice.rb
514
+ - lib/lutaml/model/schema/definitions/facet.rb
515
+ - lib/lutaml/model/schema/definitions/group_import.rb
516
+ - lib/lutaml/model/schema/definitions/member_walk.rb
517
+ - lib/lutaml/model/schema/definitions/model.rb
518
+ - lib/lutaml/model/schema/definitions/namespace.rb
519
+ - lib/lutaml/model/schema/definitions/restricted_type.rb
520
+ - lib/lutaml/model/schema/definitions/sequence.rb
521
+ - lib/lutaml/model/schema/definitions/simple_content.rb
522
+ - lib/lutaml/model/schema/definitions/transform_facet.rb
523
+ - lib/lutaml/model/schema/definitions/type_ref.rb
524
+ - lib/lutaml/model/schema/definitions/union_type.rb
525
+ - lib/lutaml/model/schema/definitions/xml_root.rb
526
+ - lib/lutaml/model/schema/file_writer.rb
500
527
  - lib/lutaml/model/schema/generator.rb
501
528
  - lib/lutaml/model/schema/generator/definition.rb
502
529
  - lib/lutaml/model/schema/generator/definitions_collection.rb
@@ -507,26 +534,41 @@ files:
507
534
  - lib/lutaml/model/schema/helpers/template_helper.rb
508
535
  - lib/lutaml/model/schema/json_schema.rb
509
536
  - lib/lutaml/model/schema/json_schema_parser.rb
537
+ - lib/lutaml/model/schema/module_nesting.rb
538
+ - lib/lutaml/model/schema/namespace_naming.rb
539
+ - lib/lutaml/model/schema/registry_generator.rb
510
540
  - lib/lutaml/model/schema/renderer.rb
541
+ - lib/lutaml/model/schema/renderers.rb
542
+ - lib/lutaml/model/schema/renderers/base.rb
543
+ - lib/lutaml/model/schema/renderers/mappings.rb
544
+ - lib/lutaml/model/schema/renderers/member_decls.rb
545
+ - lib/lutaml/model/schema/renderers/model.rb
546
+ - lib/lutaml/model/schema/renderers/namespace.rb
547
+ - lib/lutaml/model/schema/renderers/registration.rb
548
+ - lib/lutaml/model/schema/renderers/required_files_calculator.rb
549
+ - lib/lutaml/model/schema/renderers/restricted_type.rb
550
+ - lib/lutaml/model/schema/renderers/union.rb
551
+ - lib/lutaml/model/schema/rnc_compiler.rb
552
+ - lib/lutaml/model/schema/rnc_compiler/source_resolver.rb
553
+ - lib/lutaml/model/schema/rng_compiler.rb
554
+ - lib/lutaml/model/schema/rng_compiler/define_classifier.rb
555
+ - lib/lutaml/model/schema/rng_compiler/element_visitor.rb
556
+ - lib/lutaml/model/schema/rng_compiler/member_collector.rb
557
+ - lib/lutaml/model/schema/rng_compiler/rng_helpers.rb
558
+ - lib/lutaml/model/schema/rng_compiler/value_type_resolver.rb
511
559
  - lib/lutaml/model/schema/schema_builder/nokogiri.rb
512
560
  - lib/lutaml/model/schema/schema_builder/oga.rb
513
561
  - lib/lutaml/model/schema/shared_methods.rb
562
+ - lib/lutaml/model/schema/templates.rb
514
563
  - lib/lutaml/model/schema/templates/model.erb
515
564
  - lib/lutaml/model/schema/xml_compiler.rb
516
- - lib/lutaml/model/schema/xml_compiler/attribute.rb
517
- - lib/lutaml/model/schema/xml_compiler/attribute_group.rb
518
- - lib/lutaml/model/schema/xml_compiler/choice.rb
519
- - lib/lutaml/model/schema/xml_compiler/complex_content.rb
520
- - lib/lutaml/model/schema/xml_compiler/complex_content_restriction.rb
521
- - lib/lutaml/model/schema/xml_compiler/complex_type.rb
522
- - lib/lutaml/model/schema/xml_compiler/element.rb
523
- - lib/lutaml/model/schema/xml_compiler/group.rb
565
+ - lib/lutaml/model/schema/xml_compiler/element_order.rb
524
566
  - lib/lutaml/model/schema/xml_compiler/registry_generator.rb
525
- - lib/lutaml/model/schema/xml_compiler/restriction.rb
526
- - lib/lutaml/model/schema/xml_compiler/sequence.rb
527
- - lib/lutaml/model/schema/xml_compiler/simple_content.rb
528
- - lib/lutaml/model/schema/xml_compiler/simple_type.rb
529
- - lib/lutaml/model/schema/xml_compiler/xml_namespace_class.rb
567
+ - lib/lutaml/model/schema/xml_compiler/spec_builder.rb
568
+ - lib/lutaml/model/schema/xml_compiler/spec_builder/complex_types.rb
569
+ - lib/lutaml/model/schema/xml_compiler/spec_builder/members.rb
570
+ - lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb
571
+ - lib/lutaml/model/schema/xml_compiler/supported_data_types.rb
530
572
  - lib/lutaml/model/schema/yaml_schema.rb
531
573
  - lib/lutaml/model/schema_location.rb
532
574
  - lib/lutaml/model/sequence.rb
@@ -544,7 +586,6 @@ files:
544
586
  - lib/lutaml/model/serialize/value_mapping.rb
545
587
  - lib/lutaml/model/services.rb
546
588
  - lib/lutaml/model/services/base.rb
547
- - lib/lutaml/model/services/default_value_resolver.rb
548
589
  - lib/lutaml/model/services/logger.rb
549
590
  - lib/lutaml/model/services/rule_value_extractor.rb
550
591
  - lib/lutaml/model/services/transformer.rb
@@ -586,6 +627,7 @@ files:
586
627
  - lib/lutaml/model/type_resolver.rb
587
628
  - lib/lutaml/model/type_substitution.rb
588
629
  - lib/lutaml/model/uninitialized_class.rb
630
+ - lib/lutaml/model/union.rb
589
631
  - lib/lutaml/model/utils.rb
590
632
  - lib/lutaml/model/validation.rb
591
633
  - lib/lutaml/model/validation/concerns/has_issues.rb
@@ -697,6 +739,7 @@ files:
697
739
  - lib/lutaml/xml/error/invalid_namespace_error.rb
698
740
  - lib/lutaml/xml/error/invalid_xsd_type_error.rb
699
741
  - lib/lutaml/xml/error/namespace_mismatch_error.rb
742
+ - lib/lutaml/xml/error/schema_validation_error.rb
700
743
  - lib/lutaml/xml/error/xml_configuration_error.rb
701
744
  - lib/lutaml/xml/error/xml_error.rb
702
745
  - lib/lutaml/xml/format_chooser.rb
@@ -843,6 +886,7 @@ files:
843
886
  - lib/lutaml/xml/xml_element.rb
844
887
  - lib/lutaml/xml/xml_namespace.rb
845
888
  - lib/lutaml/xml/xml_orderable.rb
889
+ - lib/lutaml/xml/xsd_validator.rb
846
890
  - lib/lutaml/yaml.rb
847
891
  - lib/lutaml/yaml/adapter.rb
848
892
  - lib/lutaml/yaml/adapter/document.rb
@@ -897,6 +941,23 @@ files:
897
941
  - spec/fixtures/xml/latin_encoding.xml
898
942
  - spec/fixtures/xml/math_document_schema.xsd
899
943
  - spec/fixtures/xml/product_catalog.xsd
944
+ - spec/fixtures/xml/schema/rnc/address_book.rnc
945
+ - spec/fixtures/xml/schema/rnc/book_features.rnc
946
+ - spec/fixtures/xml/schema/rnc/includes/book.rnc
947
+ - spec/fixtures/xml/schema/rnc/includes/circular_a.rnc
948
+ - spec/fixtures/xml/schema/rnc/includes/circular_b.rnc
949
+ - spec/fixtures/xml/schema/rnc/includes/library.rnc
950
+ - spec/fixtures/xml/schema/rng/address_book.rng
951
+ - spec/fixtures/xml/schema/rng/book.rng
952
+ - spec/fixtures/xml/schema/rng/fixed_value.rng
953
+ - spec/fixtures/xml/schema/rng/fragment_in_choice.rng
954
+ - spec/fixtures/xml/schema/rng/full_name.rng
955
+ - spec/fixtures/xml/schema/rng/integer_range.rng
956
+ - spec/fixtures/xml/schema/rng/list_type.rng
957
+ - spec/fixtures/xml/schema/rng/namespaced.rng
958
+ - spec/fixtures/xml/schema/rng/paragraph.rng
959
+ - spec/fixtures/xml/schema/rng/person.rng
960
+ - spec/fixtures/xml/schema/rng/union.rng
900
961
  - spec/fixtures/xml/schema/xsd/build_test_package.rb
901
962
  - spec/fixtures/xml/schema/xsd/citygml/2.0/cityGMLBase.xsd
902
963
  - spec/fixtures/xml/schema/xsd/citygml/appearance/2.0/appearance.xsd
@@ -1557,6 +1618,11 @@ files:
1557
1618
  - spec/fixtures/xml/test_schema.xsd
1558
1619
  - spec/fixtures/xml/user.xsd
1559
1620
  - spec/fixtures/xml/valid_math_document.xml
1621
+ - spec/fixtures/xml/validate_xml_with_address.xsd
1622
+ - spec/fixtures/xml/validate_xml_with_contact.xsd
1623
+ - spec/fixtures/xml/validate_xml_with_person.xsd
1624
+ - spec/fixtures/xml/validate_xml_with_person_strict.xsd
1625
+ - spec/fixtures/xml/validate_xml_with_product.xsd
1560
1626
  - spec/fixtures/yamls_range_concept.rb
1561
1627
  - spec/lutaml/integration/edge_cases_spec.rb
1562
1628
  - spec/lutaml/integration/multi_format_spec.rb
@@ -1566,10 +1632,12 @@ files:
1566
1632
  - spec/lutaml/key_value/transformation/rule_compiler_spec.rb
1567
1633
  - spec/lutaml/key_value/transformation/value_serializer_spec.rb
1568
1634
  - spec/lutaml/key_value/transformation_spec.rb
1635
+ - spec/lutaml/model/attribute_apply_value_map_spec.rb
1569
1636
  - spec/lutaml/model/attribute_collection_spec.rb
1570
1637
  - spec/lutaml/model/attribute_default_cache_spec.rb
1571
1638
  - spec/lutaml/model/attribute_form_default_spec.rb
1572
1639
  - spec/lutaml/model/attribute_spec.rb
1640
+ - spec/lutaml/model/boot_manifest_spec.rb
1573
1641
  - spec/lutaml/model/cached_type_resolver_spec.rb
1574
1642
  - spec/lutaml/model/cdata_spec.rb
1575
1643
  - spec/lutaml/model/choice_restrict_spec.rb
@@ -1642,18 +1710,22 @@ files:
1642
1710
  - spec/lutaml/model/schema/json_schema_to_models_spec.rb
1643
1711
  - spec/lutaml/model/schema/relaxng_schema_spec.rb
1644
1712
  - spec/lutaml/model/schema/renderer_spec.rb
1713
+ - spec/lutaml/model/schema/renderers/model_spec.rb
1714
+ - spec/lutaml/model/schema/renderers/namespace_spec.rb
1715
+ - spec/lutaml/model/schema/renderers/restricted_type_spec.rb
1716
+ - spec/lutaml/model/schema/renderers/union_spec.rb
1645
1717
  - spec/lutaml/model/schema/xsd_schema_spec.rb
1646
1718
  - spec/lutaml/model/schema/yaml_schema_spec.rb
1647
1719
  - spec/lutaml/model/sequence_spec.rb
1648
1720
  - spec/lutaml/model/serializable_spec.rb
1649
1721
  - spec/lutaml/model/serializable_validation_spec.rb
1650
1722
  - spec/lutaml/model/serialize_perf_guard_spec.rb
1651
- - spec/lutaml/model/services/default_value_resolver_spec.rb
1652
1723
  - spec/lutaml/model/services/transformer_spec.rb
1653
1724
  - spec/lutaml/model/simple_model_spec.rb
1654
1725
  - spec/lutaml/model/store_spec.rb
1655
1726
  - spec/lutaml/model/toml_adapter_spec.rb
1656
1727
  - spec/lutaml/model/toml_spec.rb
1728
+ - spec/lutaml/model/transform_apply_value_map_spec.rb
1657
1729
  - spec/lutaml/model/transform_cache_spec.rb
1658
1730
  - spec/lutaml/model/transform_dynamic_attributes_spec.rb
1659
1731
  - spec/lutaml/model/transformation_builder_spec.rb
@@ -1685,6 +1757,8 @@ files:
1685
1757
  - spec/lutaml/model/type_substitution_spec.rb
1686
1758
  - spec/lutaml/model/uninitialized_class_deep_dup_spec.rb
1687
1759
  - spec/lutaml/model/uninitialized_class_spec.rb
1760
+ - spec/lutaml/model/union_attribute_spec.rb
1761
+ - spec/lutaml/model/union_spec.rb
1688
1762
  - spec/lutaml/model/utils_spec.rb
1689
1763
  - spec/lutaml/model/validation/concerns/has_issues_spec.rb
1690
1764
  - spec/lutaml/model/validation/context_spec.rb
@@ -1801,19 +1875,9 @@ files:
1801
1875
  - spec/lutaml/xml/reusable_mapping_spec.rb
1802
1876
  - spec/lutaml/xml/reused_elements_namespace_spec.rb
1803
1877
  - spec/lutaml/xml/root_mappings/nested_child_mappings_spec.rb
1804
- - spec/lutaml/xml/schema/compiler/attribute_group_spec.rb
1805
- - spec/lutaml/xml/schema/compiler/attribute_spec.rb
1806
- - spec/lutaml/xml/schema/compiler/choice_spec.rb
1807
- - spec/lutaml/xml/schema/compiler/complex_content_restriction_spec.rb
1808
- - spec/lutaml/xml/schema/compiler/complex_content_spec.rb
1809
- - spec/lutaml/xml/schema/compiler/complex_type_spec.rb
1810
- - spec/lutaml/xml/schema/compiler/element_spec.rb
1811
- - spec/lutaml/xml/schema/compiler/group_spec.rb
1812
- - spec/lutaml/xml/schema/compiler/restriction_spec.rb
1813
- - spec/lutaml/xml/schema/compiler/sequence_spec.rb
1814
- - spec/lutaml/xml/schema/compiler/simple_content_spec.rb
1815
- - spec/lutaml/xml/schema/compiler/simple_type_spec.rb
1816
1878
  - spec/lutaml/xml/schema/compiler_spec.rb
1879
+ - spec/lutaml/xml/schema/rnc_compiler_spec.rb
1880
+ - spec/lutaml/xml/schema/rng_compiler_spec.rb
1817
1881
  - spec/lutaml/xml/schema/xsd/errors/error_context_spec.rb
1818
1882
  - spec/lutaml/xml/schema/xsd/errors/suggestion_spec.rb
1819
1883
  - spec/lutaml/xml/schema/xsd/file_validation_result_spec.rb
@@ -1843,6 +1907,8 @@ files:
1843
1907
  - spec/lutaml/xml/type_namespace_prefix_spec.rb
1844
1908
  - spec/lutaml/xml/type_namespace_resolver_spec.rb
1845
1909
  - spec/lutaml/xml/type_namespace_roundtrip_spec.rb
1910
+ - spec/lutaml/xml/validate_xml_with_constructs_spec.rb
1911
+ - spec/lutaml/xml/validate_xml_with_spec.rb
1846
1912
  - spec/lutaml/xml/w3c_types_spec.rb
1847
1913
  - spec/lutaml/xml/xml_adapter_spec.rb
1848
1914
  - spec/lutaml/xml/xml_declaration_spec.rb
@@ -1,106 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Lutaml
4
- module Model
5
- module Schema
6
- module XmlCompiler
7
- class Attribute
8
- attr_accessor :id,
9
- :ref,
10
- :name,
11
- :type,
12
- :default
13
-
14
- TEMPLATE = ERB.new(<<~TEMPLATE, trim_mode: "-")
15
- <%= indent %>attribute :<%= resolved_name %>, <%= type_reference %>
16
- TEMPLATE
17
-
18
- XML_MAPPING_TEMPLATE = ERB.new(<<~XML_MAPPING_TEMPLATE, trim_mode: "-")
19
- <%= indent %>map_attribute :<%= resolved_name(change_case: false) %>, to: :<%= resolved_name %>
20
- XML_MAPPING_TEMPLATE
21
-
22
- def initialize(name: nil, ref: nil)
23
- @name = name
24
- @ref = ref
25
- end
26
-
27
- def to_attributes(indent)
28
- return if skippable?
29
-
30
- TEMPLATE.result(binding)
31
- end
32
-
33
- def to_xml_mapping(indent)
34
- return if skippable?
35
-
36
- XML_MAPPING_TEMPLATE.result(binding)
37
- end
38
-
39
- def required_files
40
- return if skippable?
41
-
42
- files = []
43
-
44
- raw_type = resolved_type(change_case: false)
45
-
46
- # Add W3C require for xml: attributes
47
- if w3c_type?(raw_type)
48
- files << "require \"lutaml/xml/w3c\""
49
- elsif raw_type == "decimal"
50
- files << "require \"bigdecimal\""
51
- elsif !SimpleType.skippable?(raw_type)
52
- files << "require_relative \"#{Utils.snake_case(raw_type)}\""
53
- end
54
-
55
- files.compact # Return all files as array
56
- end
57
-
58
- private
59
-
60
- def resolved_name(change_case: true)
61
- @current_name ||= name || referenced_instance&.name
62
- change_case ? Utils.snake_case(@current_name) : @current_name
63
- end
64
-
65
- def resolved_type(change_case: true)
66
- @current_type ||= type || referenced_instance&.type
67
-
68
- # For W3C types, return the full class name
69
- return @current_type if w3c_type?(@current_type)
70
-
71
- klass_name = last_of_split(@current_type)
72
- change_case ? Utils.snake_case(klass_name) : klass_name
73
- end
74
-
75
- def type_reference
76
- raw_type = resolved_type(change_case: false)
77
-
78
- # W3C types are full class names, use directly
79
- if w3c_type?(raw_type)
80
- "::#{raw_type}"
81
- else
82
- # Regular types are symbols
83
- ":#{resolved_type}"
84
- end
85
- end
86
-
87
- def w3c_type?(type_name)
88
- type_name&.to_s&.start_with?("Lutaml::Xml::W3c::")
89
- end
90
-
91
- def referenced_instance
92
- @referenced_instance ||= XmlCompiler.attributes[last_of_split]
93
- end
94
-
95
- def last_of_split(field = ref)
96
- field&.split(":")&.last
97
- end
98
-
99
- def skippable?
100
- resolved_name == "schema_location"
101
- end
102
- end
103
- end
104
- end
105
- end
106
- end
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Lutaml
4
- module Model
5
- module Schema
6
- module XmlCompiler
7
- class AttributeGroup
8
- attr_accessor :name, :ref, :instances
9
-
10
- def initialize(name: nil, ref: nil)
11
- @name = name
12
- @ref = ref
13
- @instances = []
14
- end
15
-
16
- def <<(instance)
17
- return if instance.nil?
18
-
19
- @instances << instance
20
- end
21
-
22
- def to_attributes(indent)
23
- resolved_instances.map { |instance| instance.to_attributes(indent) }
24
- end
25
-
26
- def to_xml_mapping(indent)
27
- resolved_instances.map do |instance|
28
- instance.to_xml_mapping(indent)
29
- end
30
- end
31
-
32
- def required_files
33
- resolved_instances.map(&:required_files)
34
- end
35
-
36
- private
37
-
38
- def resolved_instances
39
- return @instances unless Utils.present?(@ref)
40
-
41
- XmlCompiler.attribute_groups[@ref]&.instances
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,67 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Lutaml
4
- module Model
5
- module Schema
6
- module XmlCompiler
7
- class Choice
8
- attr_accessor :instances, :min_occurs, :max_occurs
9
-
10
- INDENT = " "
11
-
12
- TEMPLATE = ERB.new(<<~TEMPLATE, trim_mode: "-")
13
- <%= indent %>choice<%= block_options %> do
14
- <%= instances.map { |instance| instance.to_attributes(indent + INDENT) }.join -%>
15
- <%= indent %>end
16
- TEMPLATE
17
-
18
- def initialize
19
- @instances = []
20
- end
21
-
22
- def <<(instance)
23
- return if instance.nil?
24
-
25
- @instances << instance
26
- end
27
-
28
- def to_attributes(indent = INDENT)
29
- TEMPLATE.result(binding)
30
- end
31
-
32
- def to_xml_mapping(indent = INDENT)
33
- instances.filter_map do |instance|
34
- instance.to_xml_mapping(indent)
35
- end.join
36
- end
37
-
38
- def required_files
39
- @instances.flat_map(&:required_files).compact
40
- end
41
-
42
- private
43
-
44
- def min_option
45
- "min: #{min_occurs.nil? ? 1 : min_occurs.to_i}"
46
- end
47
-
48
- def max_option
49
- value = case max_occurs
50
- when "unbounded"
51
- "Float::INFINITY"
52
- when NilClass
53
- 1
54
- else
55
- max_occurs.to_i
56
- end
57
- ", max: #{value}"
58
- end
59
-
60
- def block_options
61
- ["(", min_option, max_option, ")"].compact.join
62
- end
63
- end
64
- end
65
- end
66
- end
67
- end
@@ -1,27 +0,0 @@
1
- module Lutaml
2
- module Model
3
- module Schema
4
- module XmlCompiler
5
- class ComplexContent
6
- attr_accessor :restriction
7
-
8
- def initialize(restriction = nil)
9
- @restriction = restriction
10
- end
11
-
12
- def to_attributes(indent)
13
- restriction&.to_attributes(indent)
14
- end
15
-
16
- def to_xml_mapping(indent)
17
- restriction&.to_xml_mapping(indent)
18
- end
19
-
20
- def required_files
21
- restriction&.required_files
22
- end
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,34 +0,0 @@
1
- module Lutaml
2
- module Model
3
- module Schema
4
- module XmlCompiler
5
- class ComplexContentRestriction
6
- attr_accessor :base, :instances
7
-
8
- def initialize(base: nil, instances: [])
9
- @base = base
10
- @instances = instances
11
- end
12
-
13
- def <<(instance)
14
- return if instance.nil?
15
-
16
- @instances << instance
17
- end
18
-
19
- def to_attributes(indent)
20
- instances.map { |instance| instance.to_attributes(indent) }
21
- end
22
-
23
- def to_xml_mapping(indent)
24
- instances.map { |instance| instance.to_xml_mapping(indent) }
25
- end
26
-
27
- def required_files
28
- instances.map(&:required_files)
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end