lutaml-model 0.8.11 → 0.8.13

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 (149) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/opal.yml +31 -0
  3. data/.rspec-opal +5 -0
  4. data/.rubocop_todo.yml +45 -34
  5. data/README.adoc +126 -104
  6. data/RELEASE_NOTES.adoc +3 -3
  7. data/benchmark/quick_benchmark.rb +2 -2
  8. data/benchmark/serialization_benchmark.rb +4 -4
  9. data/docs/_guides/advanced-mapping.adoc +1 -1
  10. data/docs/_guides/character-encoding.adoc +3 -3
  11. data/docs/_guides/index.adoc +4 -0
  12. data/docs/_guides/missing-values-handling.adoc +6 -6
  13. data/docs/_guides/ooxml-examples.adoc +7 -7
  14. data/docs/_guides/opal.adoc +221 -0
  15. data/docs/_guides/value-transformations.adoc +7 -7
  16. data/docs/_guides/xml/namespace-presentation.adoc +1 -1
  17. data/docs/_guides/xml/namespace-semantics.adoc +15 -15
  18. data/docs/_guides/xml/type-namespaces.adoc +9 -9
  19. data/docs/_guides/xml-mapping.adoc +32 -26
  20. data/docs/_guides/xml-namespace-qualification.adoc +4 -4
  21. data/docs/_guides/xml-namespaces.adoc +2 -2
  22. data/docs/_guides/xml_mappings/04_xml_namespace_class.adoc +18 -18
  23. data/docs/_guides/xml_mappings/05_common_patterns.adoc +16 -16
  24. data/docs/_guides/xml_mappings/06_migration_guide.adoc +5 -5
  25. data/docs/_guides/xml_mappings/07_best_practices.adoc +13 -12
  26. data/docs/_migrations/0-8-0-namespace-restructuring.adoc +2 -2
  27. data/docs/_pages/attributes.adoc +2 -2
  28. data/docs/_pages/collections.adoc +26 -20
  29. data/docs/_pages/configuration.adoc +9 -4
  30. data/docs/_pages/consolidation-mapping.adoc +4 -4
  31. data/docs/_pages/importable_models.adoc +14 -13
  32. data/docs/_pages/index.adoc +1 -0
  33. data/docs/_pages/quick-start.adoc +1 -1
  34. data/docs/_pages/serialization_adapters.adoc +3 -2
  35. data/docs/_pages/value_types.adoc +10 -10
  36. data/docs/_references/custom_registers.adoc +7 -7
  37. data/docs/_references/format-independent-features.adoc +4 -4
  38. data/docs/_references/instance-serialization.adoc +1 -1
  39. data/docs/_references/parent-root-context.adoc +3 -3
  40. data/docs/_tutorials/basic-model-definition.adoc +1 -1
  41. data/docs/_tutorials/first-xml-serialization.adoc +4 -4
  42. data/docs/_tutorials/lutaml-xml-architecture.adoc +4 -4
  43. data/docs/_tutorials/validation-basics.adoc +1 -1
  44. data/docs/_tutorials/working-with-collections.adoc +2 -2
  45. data/docs/_tutorials/xml-namespaces-basics.adoc +1 -1
  46. data/docs/_tutorials/xml-schema-primer-style-guide.adoc +29 -29
  47. data/docs/cli_compare.adoc +1 -1
  48. data/docs/index.adoc +2 -1
  49. data/docs/namespace-management.adoc +14 -14
  50. data/lib/lutaml/hash_format/adapter/mapping.rb +2 -4
  51. data/lib/lutaml/json/adapter/mapping.rb +2 -4
  52. data/lib/lutaml/jsonl/adapter/mapping.rb +2 -4
  53. data/lib/lutaml/key_value/adapter/hash/mapping.rb +2 -4
  54. data/lib/lutaml/key_value/adapter/json/mapping.rb +2 -4
  55. data/lib/lutaml/key_value/adapter/jsonl/mapping.rb +2 -4
  56. data/lib/lutaml/key_value/adapter/toml/mapping.rb +2 -4
  57. data/lib/lutaml/key_value/adapter/yaml/mapping.rb +2 -4
  58. data/lib/lutaml/key_value/adapter/yamls/mapping.rb +2 -4
  59. data/lib/lutaml/key_value/mapping.rb +35 -10
  60. data/lib/lutaml/model/adapter_resolver.rb +5 -8
  61. data/lib/lutaml/model/collection.rb +11 -11
  62. data/lib/lutaml/model/error/no_root_mapping_error.rb +6 -5
  63. data/lib/lutaml/model/error/no_root_namespace_error.rb +6 -5
  64. data/lib/lutaml/model/error/type_only_mapping_error.rb +13 -0
  65. data/lib/lutaml/model/error/type_only_namespace_error.rb +12 -0
  66. data/lib/lutaml/model/mapping/mapping.rb +12 -0
  67. data/lib/lutaml/model/version.rb +1 -1
  68. data/lib/lutaml/model.rb +3 -0
  69. data/lib/lutaml/toml/adapter/mapping.rb +2 -4
  70. data/lib/lutaml/xml/adapter/base_adapter.rb +0 -9
  71. data/lib/lutaml/xml/adapter/nokogiri_adapter.rb +0 -1
  72. data/lib/lutaml/xml/adapter/oga_adapter.rb +0 -1
  73. data/lib/lutaml/xml/adapter/ox_adapter.rb +0 -1
  74. data/lib/lutaml/xml/adapter/rexml_adapter.rb +0 -1
  75. data/lib/lutaml/xml/adapter/xml_serializer.rb +42 -22
  76. data/lib/lutaml/xml/adapter.rb +4 -0
  77. data/lib/lutaml/xml/builder/base.rb +64 -25
  78. data/lib/lutaml/xml/builder/nokogiri.rb +0 -2
  79. data/lib/lutaml/xml/builder/oga.rb +0 -2
  80. data/lib/lutaml/xml/builder/ox.rb +0 -2
  81. data/lib/lutaml/xml/builder/rexml.rb +0 -2
  82. data/lib/lutaml/xml/builder.rb +1 -0
  83. data/lib/lutaml/xml/configurable.rb +2 -2
  84. data/lib/lutaml/xml/declaration_handler.rb +3 -105
  85. data/lib/lutaml/xml/mapping.rb +3 -3
  86. data/lib/lutaml/xml/schema/xsd/documentation.rb +1 -1
  87. data/lib/lutaml/xml/schema/xsd.rb +5 -4
  88. data/lib/lutaml/xml/schema.rb +8 -5
  89. data/lib/lutaml/xml/serialization/collection_ext.rb +7 -7
  90. data/lib/lutaml/xml/serialization/format_conversion.rb +1 -1
  91. data/lib/lutaml/xml/serialization/instance_methods.rb +1 -1
  92. data/lib/lutaml/xml/xml_orderable.rb +17 -0
  93. data/lib/lutaml/xml.rb +9 -13
  94. data/lib/lutaml/yaml/adapter/mapping.rb +2 -4
  95. data/lib/lutaml/yamls/adapter/mapping.rb +7 -3
  96. data/lib/tasks/memory_profile.rb +2 -2
  97. data/lib/tasks/performance_benchmark.rb +5 -5
  98. data/lutaml-model.gemspec +1 -1
  99. data/spec/lutaml/key_value/transformation/rule_compiler_spec.rb +1 -1
  100. data/spec/lutaml/key_value/transformation/value_serializer_spec.rb +1 -1
  101. data/spec/lutaml/model/attribute_collection_spec.rb +1 -1
  102. data/spec/lutaml/model/cli_spec.rb +1 -1
  103. data/spec/lutaml/model/collection_spec.rb +1 -1
  104. data/spec/lutaml/model/collection_validation_spec.rb +6 -6
  105. data/spec/lutaml/model/consolidation_spec.rb +8 -8
  106. data/spec/lutaml/model/custom_collection_spec.rb +3 -3
  107. data/spec/lutaml/model/default_register_spec.rb +23 -23
  108. data/spec/lutaml/model/delegation_spec.rb +3 -10
  109. data/spec/lutaml/model/derived_attribute_serialization_spec.rb +1 -1
  110. data/spec/lutaml/model/dynamic_attribute_spec.rb +2 -2
  111. data/spec/lutaml/model/enum_spec.rb +1 -1
  112. data/spec/lutaml/model/group_spec.rb +12 -12
  113. data/spec/lutaml/model/lazy_collection_spec.rb +4 -4
  114. data/spec/lutaml/model/mixed_content_spec.rb +2 -2
  115. data/spec/lutaml/model/namespace_versioning_spec.rb +4 -4
  116. data/spec/lutaml/model/opal_smoke_spec.rb +117 -0
  117. data/spec/lutaml/model/processing_instruction_spec.rb +11 -11
  118. data/spec/lutaml/model/register_methods_spec.rb +2 -2
  119. data/spec/lutaml/model/render_empty_spec.rb +1 -1
  120. data/spec/lutaml/model/serialize_perf_guard_spec.rb +1 -1
  121. data/spec/lutaml/model/transform_dynamic_attributes_spec.rb +1 -1
  122. data/spec/lutaml/model/transformation_builder_spec.rb +2 -2
  123. data/spec/lutaml/model/xml_decoupling_spec.rb +3 -3
  124. data/spec/lutaml/model/xsd_patterns_spec.rb +2 -3
  125. data/spec/lutaml/xml/adapter/order_spec.rb +1 -1
  126. data/spec/lutaml/xml/clear_parse_state_spec.rb +1 -1
  127. data/spec/lutaml/xml/content_model_validation_spec.rb +4 -2
  128. data/spec/lutaml/xml/doubly_defined_namespace_spec.rb +5 -5
  129. data/spec/lutaml/xml/enhanced_mapping_spec.rb +2 -1
  130. data/spec/lutaml/xml/entity_fragmentation_spec.rb +5 -5
  131. data/spec/lutaml/xml/indent_spec.rb +109 -0
  132. data/spec/lutaml/xml/line_ending_spec.rb +66 -0
  133. data/spec/lutaml/xml/mapping_finalization_guard_spec.rb +2 -2
  134. data/spec/lutaml/xml/model_transform_guard_spec.rb +4 -4
  135. data/spec/lutaml/xml/namespace_alias_spec.rb +4 -4
  136. data/spec/lutaml/xml/namespace_aware_parsing_spec.rb +3 -3
  137. data/spec/lutaml/xml/namespace_bound_element_roundtrip_spec.rb +2 -2
  138. data/spec/lutaml/xml/namespace_format_preservation_spec.rb +1 -1
  139. data/spec/lutaml/xml/namespace_inheritance_spec.rb +3 -3
  140. data/spec/lutaml/xml/namespace_preservation_spec.rb +5 -5
  141. data/spec/lutaml/xml/opal_xml_spec.rb +145 -0
  142. data/spec/lutaml/xml/pipeline_integration_spec.rb +145 -0
  143. data/spec/lutaml/xml/schema_primer_spec.rb +5 -5
  144. data/spec/lutaml/xml/transformation_spec.rb +20 -20
  145. data/spec/lutaml/xml/type_namespace/collector_spec.rb +1 -1
  146. data/spec/lutaml/xml/type_namespace/planner_spec.rb +3 -3
  147. data/spec/lutaml/xml/xml_spec.rb +64 -13
  148. data/spec/support/opal.rb +6 -0
  149. metadata +16 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 992b8e51bee9c168f1dbb4cac0fcfd75f593f1c40cc29abce7e2163088e6fc48
4
- data.tar.gz: 8e3524b5e4336e8cb289c3f31b513727bb2bbb23d3429fcd770425b6f24de489
3
+ metadata.gz: da27c86db192d8d77af76f856e7cf54db5bdd8740f293ce0068940a0c44699c6
4
+ data.tar.gz: 06dfdfb95294ee9e066c34316ca1287a042000627ebe4ce77f08602cc0b477bc
5
5
  SHA512:
6
- metadata.gz: 61c349cf6a1476a0c8668ea19b45e2989275a00d97ab718613eb80cfdc86a2e71ba0cb344c69a6877c5447a57d715f080470c3b28dce0c046652502182b29408
7
- data.tar.gz: b85e8858876efa7b98acec6df1ff36e2ebbbf772c8b8cf035a459374159d2c5d704c13cbcecc99a69561438884d05bc4f52d13e12d6cd1b3f63611761344bd04
6
+ metadata.gz: 15e4876e720f00a340f6fbb7450a0911b183710cd14834b77c6c6bb50c26175f592db7316b8f15bd1d07fa50572d9780756024b185208303f24900d5f853adee
7
+ data.tar.gz: 6cad953d8d79c4a291c020ad9b00de176f2366f2223df4406b2fd70a395d3925b69b1e0a5af4e1a19bb2dd75447aec84a0d8153ad252faa7ff3a611b9e3c0dc3
@@ -0,0 +1,31 @@
1
+ name: opal
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ with:
14
+ submodules: "recursive"
15
+
16
+ - name: Set up Ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: "3.3"
20
+ bundler-cache: true
21
+
22
+ - name: Set up Node.js
23
+ uses: actions/setup-node@v4
24
+ with:
25
+ node-version: "18"
26
+
27
+ - name: Run Opal tests
28
+ # TODO: Remove continue-on-error once REXML adapter is verified
29
+ # under actual Opal runtime (REXML compiles to JS via Opal's stdlib)
30
+ run: bundle exec rake spec:opal
31
+ continue-on-error: true
data/.rspec-opal ADDED
@@ -0,0 +1,5 @@
1
+ --default-path=spec
2
+ --pattern='spec/lutaml/model/opal_smoke_spec.rb,spec/lutaml/xml/opal_xml_spec.rb'
3
+ -I lib
4
+ --require=spec_helper
5
+ --require=support/opal
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-05-20 09:01:31 UTC using RuboCop version 1.86.0.
3
+ # on 2026-05-27 05:02:01 UTC using RuboCop version 1.86.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -17,45 +17,53 @@ Gemspec/RequiredRubyVersion:
17
17
  # SupportedStyles: with_first_argument, with_fixed_indentation
18
18
  Layout/ArgumentAlignment:
19
19
  Exclude:
20
- - 'lib/lutaml/turtle/transform.rb'
21
- - 'spec/lutaml/model/store_spec.rb'
20
+ - 'spec/lutaml/model/opal_smoke_spec.rb'
22
21
 
23
- # Offense count: 3
22
+ # Offense count: 1
24
23
  # This cop supports safe autocorrection (--autocorrect).
25
- # Configuration parameters: EnforcedStyleAlignWith.
26
- # SupportedStylesAlignWith: either, start_of_block, start_of_line
27
- Layout/BlockAlignment:
24
+ Layout/ClosingParenthesisIndentation:
28
25
  Exclude:
29
- - 'spec/lutaml/model/store_spec.rb'
26
+ - 'spec/lutaml/model/opal_smoke_spec.rb'
30
27
 
31
- # Offense count: 3
28
+ # Offense count: 1
32
29
  # This cop supports safe autocorrection (--autocorrect).
33
- Layout/BlockEndNewline:
30
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
31
+ # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
32
+ Layout/FirstArgumentIndentation:
34
33
  Exclude:
35
- - 'spec/lutaml/model/store_spec.rb'
34
+ - 'spec/lutaml/model/opal_smoke_spec.rb'
36
35
 
37
- # Offense count: 6
36
+ # Offense count: 2
38
37
  # This cop supports safe autocorrection (--autocorrect).
39
- # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
40
- # SupportedStylesAlignWith: start_of_line, relative_to_receiver
41
- Layout/IndentationWidth:
38
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
39
+ # SupportedHashRocketStyles: key, separator, table
40
+ # SupportedColonStyles: key, separator, table
41
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
42
+ Layout/HashAlignment:
42
43
  Exclude:
43
- - 'spec/lutaml/model/store_spec.rb'
44
+ - 'spec/lutaml/model/opal_smoke_spec.rb'
44
45
 
45
- # Offense count: 3024
46
+ # Offense count: 3022
46
47
  # This cop supports safe autocorrection (--autocorrect).
47
48
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
48
49
  # URISchemes: http, https
49
50
  Layout/LineLength:
50
51
  Enabled: false
51
52
 
52
- # Offense count: 2
53
+ # Offense count: 1
54
+ # This cop supports safe autocorrection (--autocorrect).
55
+ # Configuration parameters: EnforcedStyle.
56
+ # SupportedStyles: symmetrical, new_line, same_line
57
+ Layout/MultilineMethodCallBraceLayout:
58
+ Exclude:
59
+ - 'spec/lutaml/model/opal_smoke_spec.rb'
60
+
61
+ # Offense count: 1
53
62
  # This cop supports safe autocorrection (--autocorrect).
54
63
  # Configuration parameters: AllowInHeredoc.
55
64
  Layout/TrailingWhitespace:
56
65
  Exclude:
57
- - 'lib/lutaml/turtle/transform.rb'
58
- - 'spec/lutaml/model/store_spec.rb'
66
+ - 'spec/lutaml/model/opal_smoke_spec.rb'
59
67
 
60
68
  # Offense count: 21
61
69
  # Configuration parameters: AllowedMethods.
@@ -148,6 +156,12 @@ Lint/UnusedMethodArgument:
148
156
  - 'lib/lutaml/xml/unqualified_inheritance_strategy.rb'
149
157
  - 'spec/support/xml/xsd/code_example_validator.rb'
150
158
 
159
+ # Offense count: 1
160
+ # This cop supports safe autocorrection (--autocorrect).
161
+ Lint/UselessAssignment:
162
+ Exclude:
163
+ - 'spec/lutaml/xml/opal_xml_spec.rb'
164
+
151
165
  # Offense count: 1
152
166
  Lint/UselessConstantScoping:
153
167
  Exclude:
@@ -277,7 +291,7 @@ RSpec/BeforeAfterAll:
277
291
  RSpec/ContextWording:
278
292
  Enabled: false
279
293
 
280
- # Offense count: 96
294
+ # Offense count: 98
281
295
  # Configuration parameters: IgnoredMetadata.
282
296
  RSpec/DescribeClass:
283
297
  Enabled: false
@@ -288,7 +302,7 @@ RSpec/DescribeMethod:
288
302
  - 'spec/lutaml/xml/schema/xsd/schema_helper_methods_spec.rb'
289
303
  - 'spec/lutaml/xml/serializable_namespace_spec.rb'
290
304
 
291
- # Offense count: 1285
305
+ # Offense count: 1301
292
306
  # Configuration parameters: CountAsOne.
293
307
  RSpec/ExampleLength:
294
308
  Max: 68
@@ -363,7 +377,7 @@ RSpec/MultipleDescribes:
363
377
  - 'spec/lutaml/xml/namespace_resolution_strategy_spec.rb'
364
378
  - 'spec/lutaml/xml/xml_space_type_spec.rb'
365
379
 
366
- # Offense count: 1507
380
+ # Offense count: 1515
367
381
  RSpec/MultipleExpectations:
368
382
  Max: 21
369
383
 
@@ -437,17 +451,6 @@ Security/MarshalLoad:
437
451
  Exclude:
438
452
  - 'scripts-xmi-profile/profile_xmi.rb'
439
453
 
440
- # Offense count: 5
441
- # This cop supports safe autocorrection (--autocorrect).
442
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
443
- # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
444
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
445
- # FunctionalMethods: let, let!, subject, watch
446
- # AllowedMethods: lambda, proc, it
447
- Style/BlockDelimiters:
448
- Exclude:
449
- - 'spec/lutaml/model/store_spec.rb'
450
-
451
454
  # Offense count: 2
452
455
  # This cop supports unsafe autocorrection (--autocorrect-all).
453
456
  # Configuration parameters: AllowedMethods, AllowedPatterns.
@@ -540,3 +543,11 @@ Style/StringConcatenation:
540
543
  - 'lib/lutaml/model/schema/xml_compiler/complex_type.rb'
541
544
  - 'lib/lutaml/model/schema/xml_compiler/simple_type.rb'
542
545
  - 'lib/lutaml/model/schema/xml_compiler/xml_namespace_class.rb'
546
+
547
+ # Offense count: 1
548
+ # This cop supports safe autocorrection (--autocorrect).
549
+ # Configuration parameters: EnforcedStyleForMultiline.
550
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
551
+ Style/TrailingCommaInArguments:
552
+ Exclude:
553
+ - 'spec/lutaml/model/opal_smoke_spec.rb'