lutaml-model 0.8.201 → 0.8.202

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 (144) hide show
  1. checksums.yaml +4 -4
  2. data/.github/scripts/test_installed_gem.rb +1 -13
  3. data/.github/workflows/downstream-performance.yml +1 -22
  4. data/.github/workflows/performance.yml +1 -33
  5. data/.github/workflows/rake.yml +2 -6
  6. data/.rubocop.yml +0 -10
  7. data/.rubocop_todo.yml +0 -4
  8. data/Gemfile +0 -23
  9. data/README.adoc +25 -86
  10. data/Rakefile +2 -167
  11. data/docs/_guides/advanced-mapping.adoc +6 -6
  12. data/docs/_guides/character-encoding.adoc +0 -3
  13. data/docs/_guides/gem-integration.adoc +1 -1
  14. data/docs/_guides/index.adoc +0 -4
  15. data/docs/_guides/xml/type-namespaces.adoc +1 -1
  16. data/docs/_guides/xml-guide-0.8.0.adoc +2 -2
  17. data/docs/_guides/xml-namespaces.adoc +2 -3
  18. data/docs/_guides/xml_mappings/03_architecture.adoc +2 -2
  19. data/docs/_guides/xml_mappings/07_best_practices.adoc +2 -3
  20. data/docs/_guides/xml_mappings/08_troubleshooting.adoc +1 -9
  21. data/docs/_pages/comparison-with-shale.adoc +1 -1
  22. data/docs/_pages/configuration.adoc +6 -40
  23. data/docs/_pages/index.adoc +0 -1
  24. data/docs/_pages/serialization_adapters.adoc +4 -16
  25. data/docs/_references/architecture.adoc +1 -1
  26. data/docs/_references/lutaml-namespace-planning.md +1 -1
  27. data/docs/_references/three-phase-namespace-architecture.adoc +1 -2
  28. data/docs/_references/xsd-generation-with-namespace-support.adoc +3 -8
  29. data/docs/_tutorials/lutaml-xml-architecture.adoc +2 -8
  30. data/docs/architecture.md +7 -11
  31. data/docs/conversion_caching.adoc +1 -1
  32. data/docs/index.adoc +0 -1
  33. data/docs/key_value_data_model.adoc +1 -1
  34. data/docs/namespace-management.adoc +4 -10
  35. data/lib/lutaml/json/format.rb +0 -1
  36. data/lib/lutaml/json/generator_options.rb +0 -1
  37. data/lib/lutaml/key_value/transform.rb +9 -16
  38. data/lib/lutaml/lml/document_builder.rb +2 -2
  39. data/lib/lutaml/lml/entity_types.rb +2 -2
  40. data/lib/lutaml/model/adapter_resolver.rb +5 -15
  41. data/lib/lutaml/model/cached_type_resolver.rb +1 -7
  42. data/lib/lutaml/model/error/unknown_adapter_type_error.rb +1 -1
  43. data/lib/lutaml/model/global_context.rb +3 -5
  44. data/lib/lutaml/model/instrumentation.rb +0 -3
  45. data/lib/lutaml/model/mapping/mapping_rule.rb +6 -10
  46. data/lib/lutaml/model/register.rb +20 -31
  47. data/lib/lutaml/model/runtime_compatibility.rb +0 -92
  48. data/lib/lutaml/model/schema/class_loader.rb +2 -4
  49. data/lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb +2 -3
  50. data/lib/lutaml/model/serialize/attribute_definition.rb +10 -184
  51. data/lib/lutaml/model/serialize/conversion_caching.rb +1 -5
  52. data/lib/lutaml/model/serialize/model_import.rb +0 -5
  53. data/lib/lutaml/model/serialize/value_mapping.rb +0 -3
  54. data/lib/lutaml/model/services/rule_value_extractor.rb +4 -7
  55. data/lib/lutaml/model/store.rb +10 -17
  56. data/lib/lutaml/model/toml.rb +0 -2
  57. data/lib/lutaml/model/transformation_registry.rb +3 -7
  58. data/lib/lutaml/model/version.rb +1 -1
  59. data/lib/lutaml/model.rb +3 -19
  60. data/lib/lutaml/toml/format.rb +4 -8
  61. data/lib/lutaml/xml/adapter/moxml_adapter.rb +1 -7
  62. data/lib/lutaml/xml/adapter.rb +0 -4
  63. data/lib/lutaml/xml/adapter_loader.rb +1 -6
  64. data/lib/lutaml/xml/builder/base.rb +0 -3
  65. data/lib/lutaml/xml/builder.rb +0 -8
  66. data/lib/lutaml/xml/data_model.rb +1 -1
  67. data/lib/lutaml/xml/doctype_extractor.rb +3 -3
  68. data/lib/lutaml/xml/format.rb +22 -74
  69. data/lib/lutaml/xml/leptris/plan_compiler.rb +1 -2
  70. data/lib/lutaml/xml/model_transform.rb +14 -24
  71. data/lib/lutaml/xml/polymorphic_value_handler.rb +1 -1
  72. data/lib/lutaml/xml/schema/builder/moxml.rb +1 -1
  73. data/lib/lutaml/xml/schema/builder.rb +6 -9
  74. data/lib/lutaml/xml/schema/relaxng_schema.rb +1 -1
  75. data/lib/lutaml/xml/xml_element.rb +3 -2
  76. data/lib/lutaml/xml/xsd_validator.rb +4 -11
  77. data/lib/lutaml/yaml/adapter/yeptris_adapter.rb +2 -2
  78. data/lib/lutaml/yamls/adapter_loader.rb +1 -5
  79. data/lib/tasks/performance_comparator.rb +1 -1
  80. data/lutaml-model.gemspec +3 -8
  81. data/spec/benchmarks/xml_parsing_benchmark_spec.rb +1 -1
  82. data/spec/lutaml/json/adapter/standard_adapter_spec.rb +6 -9
  83. data/spec/lutaml/model/adapter_resolver_yeptris_switch_spec.rb +0 -2
  84. data/spec/lutaml/model/cached_type_resolver_spec.rb +2 -54
  85. data/spec/lutaml/model/cdata_spec.rb +2 -15
  86. data/spec/lutaml/model/encoding_spec.rb +0 -9
  87. data/spec/lutaml/model/except_spec.rb +0 -7
  88. data/spec/lutaml/model/json_spec.rb +0 -14
  89. data/spec/lutaml/model/mixed_content_spec.rb +6 -46
  90. data/spec/lutaml/model/ordered_content_spec.rb +0 -7
  91. data/spec/lutaml/model/processing_instruction_spec.rb +0 -6
  92. data/spec/lutaml/model/runtime_compatibility_spec.rb +0 -37
  93. data/spec/lutaml/model/serializable_spec.rb +0 -2
  94. data/spec/lutaml/model/toml_spec.rb +0 -23
  95. data/spec/lutaml/xml/adapter/base_adapter_regression_spec.rb +0 -4
  96. data/spec/lutaml/xml/adapter/order_spec.rb +1 -1
  97. data/spec/lutaml/xml/adapter/xml_namespace_spec.rb +0 -7
  98. data/spec/lutaml/xml/attribute_namespace_disjointness_spec.rb +6 -6
  99. data/spec/lutaml/xml/builder/builder_spec.rb +0 -24
  100. data/spec/lutaml/xml/default_namespace_spec.rb +1 -8
  101. data/spec/lutaml/xml/doctype_preservation_spec.rb +0 -4
  102. data/spec/lutaml/xml/entity_fragmentation_spec.rb +0 -6
  103. data/spec/lutaml/xml/fpi_namespace_spec.rb +0 -21
  104. data/spec/lutaml/xml/mapping_spec.rb +8 -15
  105. data/spec/lutaml/xml/namespace_scope_vcard_spec.rb +0 -7
  106. data/spec/lutaml/xml/namespace_spec.rb +0 -13
  107. data/spec/lutaml/xml/prefix_control_spec.rb +0 -6
  108. data/spec/lutaml/xml/schema/builder_moxml_spec.rb +1 -1
  109. data/spec/lutaml/xml/xml_adapter_spec.rb +0 -7
  110. data/spec/lutaml/xml/xml_spec.rb +2 -88
  111. data/spec/spec_helper.rb +5 -24
  112. data/spec/support/test_adapter_config.rb +6 -6
  113. metadata +1 -32
  114. data/.github/workflows/js-pr-check.yml +0 -106
  115. data/.github/workflows/js-sync.yml +0 -55
  116. data/.github/workflows/opal.yml +0 -65
  117. data/.gitmodules +0 -6
  118. data/.rspec-opal +0 -5
  119. data/docs/_guides/opal.adoc +0 -232
  120. data/lib/compat/opal/generate_boot.rb +0 -137
  121. data/lib/compat/opal/js_bundle_entry.rb +0 -42
  122. data/lib/compat/opal/lutaml_model_boot.rb +0 -638
  123. data/lib/compat/opal/monitor.rb +0 -31
  124. data/lib/compat/opal/moxml/adapter/customized_rexml/entity_reference.rb +0 -9
  125. data/lib/compat/opal/moxml/adapter/customized_rexml/formatter.rb +0 -225
  126. data/lib/compat/opal/moxml/adapter/customized_rexml.rb +0 -11
  127. data/lib/compat/opal/moxml_boot.rb +0 -68
  128. data/lib/compat/opal/objectspace_shim.rb +0 -23
  129. data/lib/compat/opal/rexml/namespace.rb +0 -59
  130. data/lib/compat/opal/rexml/parsers/baseparser.rb +0 -1016
  131. data/lib/compat/opal/rexml/source.rb +0 -214
  132. data/lib/compat/opal/rexml/text.rb +0 -426
  133. data/lib/compat/opal/rexml/xmltokens.rb +0 -45
  134. data/lib/compat/opal/rexml_compat.rb +0 -85
  135. data/lib/compat/opal/yaml_compat.rb +0 -32
  136. data/lib/lutaml/model/cached_type_resolver/mutex_hash_cache.rb +0 -53
  137. data/lib/lutaml/model/schema/schema_builder/oga.rb +0 -92
  138. data/lib/lutaml/xml/schema/builder/oga.rb +0 -92
  139. data/spec/lutaml/model/boot_manifest_spec.rb +0 -30
  140. data/spec/lutaml/model/opal_smoke_spec.rb +0 -199
  141. data/spec/lutaml/model/serialize/attribute_definition_block_form_spec.rb +0 -244
  142. data/spec/lutaml/xml/adapter/oga_adapter_spec.rb +0 -135
  143. data/spec/lutaml/xml/opal_xml_spec.rb +0 -204
  144. data/spec/support/opal.rb +0 -9
@@ -13,11 +13,7 @@ module Lutaml
13
13
  # @param _adapter [String] the adapter format name ("yamls")
14
14
  # @param type [String] the normalized type name (e.g., "yeptris_adapter")
15
15
  def self.load_adapter_file(_adapter, type)
16
- adapter_path = if Lutaml::Model.opal?
17
- "lutaml/yamls/adapter/#{type}"
18
- else
19
- File.join(File.dirname(__FILE__), "adapter", type)
20
- end
16
+ adapter_path = File.join(File.dirname(__FILE__), "adapter", type)
21
17
  require adapter_path
22
18
  rescue LoadError => e
23
19
  raise Lutaml::Model::UnknownAdapterTypeError.new("yamls", type),
@@ -11,7 +11,7 @@ class PerformanceComparator
11
11
  BENCH_SCRIPT = File.join(TMP_PERF_DIR, "benchmark_runner.rb")
12
12
 
13
13
  BENCHMARK_MATRIX = {
14
- xml: %i[nokogiri ox oga rexml],
14
+ xml: %i[nokogiri ox rexml],
15
15
  json: %i[standard_json multi_json oj yeptris],
16
16
  yaml: %i[standard_yaml yeptris],
17
17
  toml: %i[toml_rb tomlib teptris],
data/lutaml-model.gemspec CHANGED
@@ -23,8 +23,6 @@ Gem::Specification.new do |spec|
23
23
  # Specify which files should be added to the gem when it is released.
24
24
  # The `git ls-files -z` loads the files in the
25
25
  # RubyGem that have been added into git.
26
- # vendor/ is excluded so the opal-oga / opal-ruby-ll submodule checkouts
27
- # are not shipped in the published gem.
28
26
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
29
27
  `git ls-files -z`.split("\x0").reject do |f|
30
28
  f.match(%r{^(test|features|vendor/)/})
@@ -41,15 +39,12 @@ Gem::Specification.new do |spec|
41
39
  # 0.5.84 always passes XML_PARSE_HUGE to libxml2: very large documents
42
40
  # parse completely instead of being silently truncated at the 10 MB
43
41
  # input-buffer cap (lutaml-model#871).
44
- # moxml 0.6.0 removed the Opal surface (lutaml/moxml#516, the
45
- # cross-language program's phase 4); the CRuby facade faces this
42
+ # moxml 0.6.0 removed its JavaScript-runtime surface (lutaml/moxml#516,
43
+ # the cross-language program's phase 4); the CRuby facade faces this
46
44
  # gem uses are unchanged, and the full suite is green on the 0.6
47
45
  # line (6386/0 with 0.6.0 resolved). Owner call (2026-10-31):
48
46
  # forward-pin the 0.6 series, matching canon (lutaml/canon#298);
49
- # floored at 0.6.1 per the maintainer's directive. The Opal lane's
50
- # workspace-local 0.5.x pin is retired with this floor — it cannot
51
- # resolve against it — and the boot's lib/compat/opal append is
52
- # directory-guarded in the Rakefile for both lines.
47
+ # floored at 0.6.1 per the maintainer's directive.
53
48
  # 0.6.23: preprocess_entities stopped rewriting the declared
54
49
  # encoding of text payloads beginning with an XML declaration
55
50
  # (lutaml/moxml#604) — the text-emission verbatim contract
@@ -42,7 +42,7 @@ RSpec.describe "XML adapter benchmark", :benchmark do
42
42
  GC.stat(:total_allocated_objects) - before
43
43
  end
44
44
 
45
- %i[nokogiri ox oga rexml leptris].each do |adapter|
45
+ %i[nokogiri ox rexml leptris].each do |adapter|
46
46
  it "#{adapter}: from_xml/to_xml i/s and allocations" do
47
47
  model = nil
48
48
  Lutaml::Model::Config.with_adapter(xml: adapter) do
@@ -106,11 +106,8 @@ RSpec.describe Lutaml::Json::Adapter::StandardAdapter do
106
106
  end
107
107
 
108
108
  describe Lutaml::Json::GeneratorOptions do
109
- # The derived half of the allowlist reads JSON::State, which Opal's JSON
110
- # shim does not define. BASE_PERMITTED is what the filter falls back to
111
- # there, so it has to stand on its own.
112
- # BASE_PERMITTED is the whole allowlist on Opal, whose JSON shim has no
113
- # State class for DERIVED_PERMITTED to read. So it has to stand alone
109
+ # BASE_PERMITTED is what the filter falls back to when JSON::State is
110
+ # not defined for DERIVED_PERMITTED to read. So it has to stand alone
114
111
  # against the real generator, not merely be a subset of something larger.
115
112
  it "permits only options the running generator actually accepts" do
116
113
  rejected = described_class::BASE_PERMITTED.reject do |key|
@@ -128,10 +125,10 @@ RSpec.describe Lutaml::Json::Adapter::StandardAdapter do
128
125
  expect(rejected).to eq([])
129
126
  end
130
127
 
131
- # Opal's JSON shim defines no State class, so DERIVED_PERMITTED is empty
132
- # there and the whole module must still load. Asserting that
133
- # BASE_PERMITTED contains some symbols does not exercise the guard; only
134
- # loading the file with JSON::State absent does.
128
+ # Without a JSON::State class DERIVED_PERMITTED is empty and the whole
129
+ # module must still load. Asserting that BASE_PERMITTED contains some
130
+ # symbols does not exercise the guard; only loading the file with
131
+ # JSON::State absent does.
135
132
  it "loads and still permits the base set when JSON::State is absent" do
136
133
  hide_const("JSON::State")
137
134
 
@@ -51,8 +51,6 @@ RSpec.describe "yeptris engine preference" do
51
51
  end
52
52
 
53
53
  def yeptris_engine_available?
54
- return false if RUBY_ENGINE == "opal"
55
-
56
54
  Lutaml::Model::Utils.safe_load("yeptris", :Yeptris)
57
55
  end
58
56
 
@@ -66,31 +66,17 @@ RSpec.describe Lutaml::Model::CachedTypeResolver do
66
66
  it_behaves_like "a resolver cache backend"
67
67
  end
68
68
 
69
- describe described_class::MutexHashCache do
70
- subject(:cache_backend) { described_class.new }
71
-
72
- it_behaves_like "a resolver cache backend"
73
- end
74
-
75
69
  describe "#initialize" do
76
70
  it "stores the delegate resolver" do
77
71
  expect(resolver.delegate).to eq(Lutaml::Model::TypeResolver)
78
72
  end
79
73
 
80
- it "uses ConcurrentMapCache by default on native Ruby" do
74
+ it "uses ConcurrentMapCache by default" do
81
75
  expect(resolver.cache_backend).to be_a(described_class::ConcurrentMapCache)
82
76
  end
83
77
 
84
- it "uses MutexHashCache by default on Opal" do
85
- allow(Lutaml::Model::RuntimeCompatibility).to receive(:opal?).and_return(true)
86
-
87
- opal_resolver = described_class.new(delegate: Lutaml::Model::TypeResolver)
88
-
89
- expect(opal_resolver.cache_backend).to be_a(described_class::MutexHashCache)
90
- end
91
-
92
78
  it "accepts an injected cache backend" do
93
- cache_backend = described_class::MutexHashCache.new
79
+ cache_backend = described_class::ConcurrentMapCache.new
94
80
 
95
81
  injected_resolver = described_class.new(
96
82
  delegate: Lutaml::Model::TypeResolver,
@@ -321,42 +307,4 @@ RSpec.describe Lutaml::Model::CachedTypeResolver do
321
307
  expect(stats[:keys]).to contain_exactly(%i[ctx2 custom])
322
308
  end
323
309
  end
324
-
325
- describe "Opal compatibility" do
326
- let(:resolver) { described_class.new(delegate: Lutaml::Model::TypeResolver) }
327
-
328
- before do
329
- allow(Lutaml::Model::RuntimeCompatibility).to receive(:opal?).and_return(true)
330
- end
331
-
332
- it "uses the MutexHashCache by default on Opal" do
333
- expect(resolver.cache_backend).to be_a(described_class::MutexHashCache)
334
- end
335
-
336
- it "does not autoload the native ConcurrentMapCache on Opal" do
337
- hide_const("Lutaml::Model::CachedTypeResolver::ConcurrentMapCache")
338
-
339
- load File.expand_path(
340
- "../../../lib/lutaml/model/cached_type_resolver.rb", __dir__
341
- )
342
-
343
- expect(described_class.autoload?(:ConcurrentMapCache)).to be_nil
344
- end
345
-
346
- it "caches resolved types without Concurrent::Map" do
347
- resolver.resolve(:custom, context)
348
- registry.clear
349
-
350
- expect(resolver.resolve(:custom, context)).to eq(custom_class)
351
- expect(resolver.cache_stats[:keys]).to eq([%i[test custom]])
352
- end
353
-
354
- it "clears the Opal cache" do
355
- resolver.resolve(:custom, context)
356
-
357
- resolver.clear_all_caches
358
-
359
- expect(resolver.cache_stats[:size]).to eq(0)
360
- end
361
- end
362
310
  end
@@ -335,17 +335,6 @@ RSpec.describe CdataSpec do
335
335
  XML
336
336
  end
337
337
 
338
- let(:expected_oga_xml) do
339
- "<CustomModelParent>" \
340
- "<first_name><![CDATA[John]]></first_name>" \
341
- "<last_name>Doe</last_name>" \
342
- "<CustomModelChild>" \
343
- "<street><![CDATA[Oxford Street]]></street>" \
344
- "<city><![CDATA[London]]></city>" \
345
- "</CustomModelChild>" \
346
- "</CustomModelParent>"
347
- end
348
-
349
338
  describe ".from_xml" do
350
339
  it "maps XML content to custom model using custom methods" do
351
340
  instance = parent_mapper.from_xml(input_xml)
@@ -366,9 +355,7 @@ RSpec.describe CdataSpec do
366
355
  instance = parent_mapper.from_xml(input_xml)
367
356
  result_xml = parent_mapper.to_xml(instance)
368
357
 
369
- expected_output = if adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga)
370
- expected_oga_xml
371
- elsif adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox)
358
+ expected_output = if adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox)
372
359
  expected_ox_xml
373
360
  else
374
361
  expected_nokogiri_xml
@@ -570,7 +557,7 @@ RSpec.describe CdataSpec do
570
557
  end
571
558
  end
572
559
 
573
- %i[nokogiri ox oga rexml].each do |engine|
560
+ %i[nokogiri ox rexml].each do |engine|
574
561
  next unless TestAdapterConfig.adapter_enabled?(engine)
575
562
 
576
563
  describe "the :#{engine} lane" do
@@ -269,13 +269,4 @@ RSpec.describe "XML Encoding Handling" do
269
269
  end
270
270
  end
271
271
  end
272
-
273
- if defined?(Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga))
274
- describe "with Oga adapter" do
275
- if TestAdapterConfig.adapter_enabled?(:oga)
276
- it_behaves_like "encoding behavior",
277
- Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga)
278
- end
279
- end
280
- end
281
272
  end
@@ -215,13 +215,6 @@ RSpec.describe "Except" do
215
215
  it_behaves_like "xml", described_class
216
216
  end
217
217
 
218
- describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga) do
219
- if TestAdapterConfig.adapter_enabled?(:oga)
220
- it_behaves_like "xml",
221
- described_class
222
- end
223
- end
224
-
225
218
  describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox) do
226
219
  if TestAdapterConfig.adapter_enabled?(:ox)
227
220
  it_behaves_like "xml",
@@ -15,18 +15,4 @@ RSpec.describe Lutaml::Model::Json do
15
15
  expect(result).to include("ok")
16
16
  end
17
17
  end
18
-
19
- describe "adapter autoloading" do
20
- it "does not autoload native JSON adapters on Opal" do
21
- %i[OjAdapter MultiJsonAdapter].each do |constant_name|
22
- hide_const("Lutaml::Json::Adapter::#{constant_name}")
23
- end
24
-
25
- allow(Lutaml::Model::RuntimeCompatibility).to receive(:opal?).and_return(true)
26
- load File.expand_path("../../../lib/lutaml/json/adapter.rb", __dir__)
27
-
28
- expect(Lutaml::Json::Adapter.autoload?(:OjAdapter)).to be_nil
29
- expect(Lutaml::Json::Adapter.autoload?(:MultiJsonAdapter)).to be_nil
30
- end
31
- end
32
18
  end
@@ -803,7 +803,7 @@ RSpec.describe "MixedContent" do
803
803
  describe ".from_xml" do
804
804
  let(:expected_nokogiri_content) do
805
805
  # Moxml resolves numeric character references (&#x2014;, &#xA9;) to
806
- # their Unicode characters, matching Oga/Rexml behavior. Raw Nokogiri
806
+ # their Unicode characters, matching the Rexml behavior. Raw Nokogiri
807
807
  # preserved numeric refs via native serialization, but the resolved
808
808
  # form is semantically identical.
809
809
  "B <p>R&amp;C</p>\n C <p>J\u{2014}C</p>\n O <p>A &amp; B </p>\n F <p>Z \u{A9}S</p>"
@@ -811,9 +811,6 @@ RSpec.describe "MixedContent" do
811
811
  let(:expected_ox_content) do
812
812
  "B <p>R&amp;C</p> C <p>J—C</p> O <p>A &amp; B </p> F <p>Z ©S</p>"
813
813
  end
814
- let(:expected_oga_content) do
815
- "B <p>R&amp;C</p>\n C <p>J—C</p>\n O <p>A &amp; B </p>\n F <p>Z ©S</p>"
816
- end
817
814
  let(:expected_rexml_content) do
818
815
  "B <p>R&amp;C</p>\n C <p>J—C</p>\n O <p>A &amp; B </p>\n F <p>Z ©S</p>"
819
816
  end
@@ -851,18 +848,6 @@ RSpec.describe "MixedContent" do
851
848
  XML
852
849
  end
853
850
 
854
- let(:expected_oga_xml) do
855
- <<~XML
856
- <SpecialCharContentWithRawOptionAndMixedOption>
857
- <special> B <p>R&amp;C</p>
858
- C <p>J—C</p>
859
- O <p>A &amp; B </p>
860
- F <p>Z ©S</p>
861
- </special>
862
- </SpecialCharContentWithRawOptionAndMixedOption>
863
- XML
864
- end
865
-
866
851
  let(:expected_rexml_xml) do
867
852
  <<~XML
868
853
  <SpecialCharContentWithRawOptionAndMixedOption>
@@ -881,9 +866,9 @@ RSpec.describe "MixedContent" do
881
866
 
882
867
  expected_xml = send(:"expected_#{adapter_class.type}_xml")
883
868
 
884
- # Ox and Oga normalize whitespace in mixed content per XML spec (semantically equivalent)
869
+ # Ox normalizes whitespace in mixed content per XML spec (semantically equivalent)
885
870
  # Canon can't compare whitespace-normalized XML, so we normalize both sides
886
- if [Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox), Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga)].include?(adapter_class)
871
+ if adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox)
887
872
  normalize = ->(str) {
888
873
  str.gsub(/\s+/, " ").gsub(/\s*</, "<").gsub(/>\s*/, ">").strip
889
874
  }
@@ -921,7 +906,6 @@ RSpec.describe "MixedContent" do
921
906
  describe ".to_xml" do
922
907
  let(:expected_nokogiri_xml) { "B <p>R&amp;C</p>" }
923
908
  let(:expected_ox_xml) { "B <p>R&amp;C</p>" }
924
- let(:expected_oga_xml) { "B <p>R&amp;C</p>" }
925
909
  let(:expected_rexml_xml) { "B <p>R&amp;C</p>" }
926
910
 
927
911
  it "serializes special char mixed content correctly" do
@@ -958,9 +942,6 @@ RSpec.describe "MixedContent" do
958
942
  let(:expected_xml) do
959
943
  "<TextualSupport>\n <value>&lt;computer security&gt; type of operation specified by an access right</value>\n</TextualSupport>"
960
944
  end
961
- let(:expected_oga_xml) do
962
- "<TextualSupport><value>&lt;computer security&gt; type of operation specified by an access right</value></TextualSupport>"
963
- end
964
945
 
965
946
  it "serializes special char mixed content correctly" do
966
947
  parsed = MixedContentSpec::TextualSupport.from_xml(xml)
@@ -1007,16 +988,12 @@ RSpec.describe "MixedContent" do
1007
988
 
1008
989
  context "when encoding: nil xml" do
1009
990
  let(:expected_encoding_nil_nokogiri_xml) do
1010
- # Moxml resolves numeric character references to Unicode,
1011
- # matching Oga/Rexml behavior (see expected_encoding_nil_oga_xml).
991
+ # Moxml resolves numeric character references to Unicode.
1012
992
  "\u{2211}computer security\u{220F} type of \u{200B} operation specified \u{B5} by an access right"
1013
993
  end
1014
994
  let(:expected_encoding_nil_ox_xml) do
1015
995
  "<HexCode> \xE2\x88\x91computer security\xE2\x88\x8F type of \xE2\x80\x8B operation specified \xC2\xB5 by an access right </HexCode>\n".force_encoding("ASCII-8BIT")
1016
996
  end
1017
- let(:expected_encoding_nil_oga_xml) do
1018
- "<HexCode>\n ∑computer security∏ type of ​ operation specified µ by an access right\n</HexCode>"
1019
- end
1020
997
 
1021
998
  it "serializes special char mixed content correctly with encoding: nil to get hexcode" do
1022
999
  parsed = MixedContentSpec::HexCode.from_xml(xml, encoding: nil)
@@ -1026,8 +1003,6 @@ RSpec.describe "MixedContent" do
1026
1003
  expected_encoding_nil_nokogiri_xml
1027
1004
  elsif adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox)
1028
1005
  expected_encoding_nil_ox_xml
1029
- else
1030
- expected_encoding_nil_oga_xml
1031
1006
  end
1032
1007
 
1033
1008
  expect(parsed.encoding).to be_nil
@@ -1078,11 +1053,7 @@ RSpec.describe "MixedContent" do
1078
1053
  parsed = MixedContentSpec::Shift.from_xml(fixture,
1079
1054
  encoding: "Shift_JIS")
1080
1055
  serialized = parsed.to_xml
1081
- expected = if adapter_class.type == "oga"
1082
- fixture.gsub(/\s+/, "")
1083
- else
1084
- fixture.strip
1085
- end
1056
+ expected = fixture.strip
1086
1057
  expect(serialized.strip).to eq(expected)
1087
1058
  end
1088
1059
 
@@ -1155,11 +1126,7 @@ RSpec.describe "MixedContent" do
1155
1126
  parsed = MixedContentSpec::Latin.from_xml(fixture,
1156
1127
  encoding: "ISO-8859-1")
1157
1128
  serialized = parsed.to_xml
1158
- expected_xml = if adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga)
1159
- "<note><to>José</to><from>Müller</from><heading>Reminder</heading></note>"
1160
- else
1161
- "<note>\n <to>José</to>\n <from>Müller</from>\n <heading>Reminder</heading>\n</note>"
1162
- end
1129
+ expected_xml = "<note>\n <to>José</to>\n <from>Müller</from>\n <heading>Reminder</heading>\n</note>"
1163
1130
  expect(serialized.encode("UTF-8").strip).to be_xml_equivalent_to(expected_xml.encode("UTF-8"))
1164
1131
  end
1165
1132
  end
@@ -1491,13 +1458,6 @@ RSpec.describe "MixedContent" do
1491
1458
  end
1492
1459
  end
1493
1460
 
1494
- describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga) do
1495
- if TestAdapterConfig.adapter_enabled?(:oga)
1496
- it_behaves_like "mixed content behavior",
1497
- described_class
1498
- end
1499
- end
1500
-
1501
1461
  describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:rexml) do
1502
1462
  if TestAdapterConfig.adapter_enabled?(:rexml)
1503
1463
  it_behaves_like "mixed content behavior",
@@ -196,13 +196,6 @@ RSpec.describe "OrderedContent" do
196
196
  end
197
197
  end
198
198
 
199
- describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga) do
200
- if TestAdapterConfig.adapter_enabled?(:oga)
201
- it_behaves_like "ordered content behavior",
202
- described_class
203
- end
204
- end
205
-
206
199
  describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:rexml) do
207
200
  if TestAdapterConfig.adapter_enabled?(:rexml)
208
201
  it_behaves_like "ordered content behavior",
@@ -357,12 +357,6 @@ RSpec.describe "Processing Instructions" do
357
357
  end
358
358
  end
359
359
 
360
- describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga) do
361
- if TestAdapterConfig.adapter_enabled?(:oga)
362
- it_behaves_like "PI round-trip behavior", described_class
363
- end
364
- end
365
-
366
360
  describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:rexml) do
367
361
  if TestAdapterConfig.adapter_enabled?(:rexml)
368
362
  it_behaves_like "PI round-trip behavior", described_class
@@ -3,18 +3,6 @@
3
3
  require "spec_helper"
4
4
 
5
5
  RSpec.describe Lutaml::Model::RuntimeCompatibility do
6
- describe ".opal?" do
7
- it "memoizes false results on native Ruby" do
8
- skip "native-only memoization example" if RUBY_ENGINE == "opal"
9
-
10
- described_class.remove_instance_variable(:@opal) if described_class.instance_variable_defined?(:@opal)
11
-
12
- expect(described_class.opal?).to be(false)
13
- expect(described_class.instance_variable_defined?(:@opal)).to be(true)
14
- expect(described_class.instance_variable_get(:@opal)).to be(false)
15
- end
16
- end
17
-
18
6
  describe ".safe_constantize" do
19
7
  it "returns nil when the top-level constant is missing" do
20
8
  expect(described_class.safe_constantize("MissingTopLevel::Error")).to be_nil
@@ -33,29 +21,4 @@ RSpec.describe Lutaml::Model::RuntimeCompatibility do
33
21
  .to eq(error_class)
34
22
  end
35
23
  end
36
-
37
- # lib/lutaml/model.rb and lib/lutaml/xml.rb re-evaluate their top-level
38
- # prepend calls when Opal's eager loader processes them more than once.
39
- # Opal's Module#prepend raises "Prepending a module multiple times is
40
- # not supported" in that case; runtime_compatibility.rb aligns Opal
41
- # with MRI's idempotent behavior. MRI has been idempotent since 2.0,
42
- # so the spec applies to both runtimes.
43
- describe "Module#prepend idempotency" do
44
- it "is a no-op when the module is already in the ancestor chain" do
45
- mod = Module.new
46
- klass = Class.new
47
- klass.prepend(mod)
48
-
49
- expect { klass.prepend(mod) }.not_to raise_error
50
- expect(klass.ancestors.count(mod)).to eq(1)
51
- end
52
-
53
- it "still prepends when the module is not yet present" do
54
- mod = Module.new
55
- klass = Class.new
56
-
57
- expect { klass.prepend(mod) }.not_to raise_error
58
- expect(klass.ancestors).to include(mod)
59
- end
60
- end
61
24
  end
@@ -565,7 +565,6 @@ RSpec.describe Lutaml::Model::Serializable do
565
565
  xml: {
566
566
  nokogiri: "<<<<name>John Doe</name>",
567
567
  ox: "<<<<name>John Doe</name>",
568
- oga: '<person xmlns="http://example.com" xmlns="http://another.com"><name>John Doe</name></person>',
569
568
  rexml: "<root><tag></root>",
570
569
  },
571
570
  json: {
@@ -608,7 +607,6 @@ RSpec.describe Lutaml::Model::Serializable do
608
607
  describe "invalid format handling for XML" do
609
608
  it_behaves_like "invalid format error", :xml, :nokogiri, :from_xml, :xml
610
609
  it_behaves_like "invalid format error", :xml, :ox, :from_xml, :xml
611
- it_behaves_like "invalid format error", :xml, :oga, :from_xml, :xml
612
610
  it_behaves_like "invalid format error", :xml, :rexml, :from_xml, :xml
613
611
  end
614
612
 
@@ -8,19 +8,6 @@ RSpec.describe Lutaml::Model::Toml do
8
8
  it "does not eagerly register a native TOML adapter class" do
9
9
  expect(Lutaml::Model::FormatRegistry.info(:toml)[:adapter_class]).to be_nil
10
10
  end
11
-
12
- it "does not autoload native TOML adapters on Opal" do
13
- %i[TomlRbAdapter TomlibAdapter TeptrisAdapter].each do |constant_name|
14
- hide_const("Lutaml::Toml::Adapter::#{constant_name}")
15
- end
16
-
17
- allow(Lutaml::Model::RuntimeCompatibility).to receive(:opal?).and_return(true)
18
- load File.expand_path("../../../lib/lutaml/toml/adapter.rb", __dir__)
19
-
20
- expect(Lutaml::Toml::Adapter.autoload?(:TomlRbAdapter)).to be_nil
21
- expect(Lutaml::Toml::Adapter.autoload?(:TomlibAdapter)).to be_nil
22
- expect(Lutaml::Toml::Adapter.autoload?(:TeptrisAdapter)).to be_nil
23
- end
24
11
  end
25
12
 
26
13
  describe ".detect_toml_adapter" do
@@ -100,16 +87,6 @@ RSpec.describe Lutaml::Model::Toml do
100
87
  end
101
88
  end
102
89
 
103
- context "when running on Opal" do
104
- before do
105
- allow(Lutaml::Model::RuntimeCompatibility).to receive(:opal?).and_return(true)
106
- end
107
-
108
- it "returns nil" do
109
- expect(described_class.detect_toml_adapter).to be_nil
110
- end
111
- end
112
-
113
90
  context "when both adapters are available" do
114
91
  before do
115
92
  stub_const("Tomlib", Module.new)
@@ -138,10 +138,6 @@ RSpec.describe Lutaml::Xml::Adapter::BaseAdapter do
138
138
  it_behaves_like "base adapter regressions", Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox)
139
139
  end
140
140
 
141
- context "with OgaAdapter" do
142
- it_behaves_like "base adapter regressions", Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga)
143
- end
144
-
145
141
  context "with RexmlAdapter" do
146
142
  it_behaves_like "base adapter regressions", Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:rexml)
147
143
  end
@@ -125,7 +125,7 @@ RSpec.describe "XML adapter order metadata" do
125
125
  end
126
126
  end
127
127
 
128
- %i[nokogiri ox oga rexml].each do |engine|
128
+ %i[nokogiri ox rexml].each do |engine|
129
129
  describe "the :#{engine} lane" do
130
130
  it_behaves_like "consistent order metadata",
131
131
  Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(engine)
@@ -512,13 +512,6 @@ RSpec.describe "XmlNamespace" do
512
512
  end
513
513
  end
514
514
 
515
- describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga) do
516
- if TestAdapterConfig.adapter_enabled?(:oga)
517
- it_behaves_like "an XML namespace parser",
518
- described_class
519
- end
520
- end
521
-
522
515
  describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:rexml) do
523
516
  if TestAdapterConfig.adapter_enabled?(:rexml)
524
517
  it_behaves_like "an XML namespace parser",
@@ -7,8 +7,8 @@ require "spec_helper"
7
7
  # serialization (lutaml-model#744).
8
8
  #
9
9
  # The coexisting-spelling cases under nokogiri/rexml additionally require the
10
- # moxml adapter fixes (lutaml/moxml#94, lutaml/moxml#95); oga and ox already
11
- # preserve same-local-name attributes across namespaces.
10
+ # moxml adapter fixes (lutaml/moxml#94, lutaml/moxml#95); ox already
11
+ # preserves same-local-name attributes across namespaces.
12
12
  module AttributeNamespaceDisjointnessSpec
13
13
  class XmiNs < Lutaml::Xml::Namespace
14
14
  uri "http://www.example.com/xmi"
@@ -56,7 +56,7 @@ RSpec.describe "Attribute namespace-disjoint parsing" do
56
56
  %(<probe type="EAnone_void" xmlns:xmi="http://www.example.com/xmi" xmi:type="uml:Parameter"/>)
57
57
  end
58
58
 
59
- %i[oga ox nokogiri].each do |adapter|
59
+ %i[ox nokogiri].each do |adapter|
60
60
  context "with the #{adapter} adapter" do
61
61
  it "routes a namespaced rule to the attribute bound to its URI" do
62
62
  probe = AttributeNamespaceDisjointnessSpec.parse(namespaced_xmi,
@@ -85,8 +85,8 @@ RSpec.describe "Attribute namespace-disjoint parsing" do
85
85
 
86
86
  # Same-local-name attributes coexisting on one element require the moxml
87
87
  # fixes (lutaml/moxml#94 drops one under nokogiri; lutaml/moxml#95 crashes
88
- # under rexml), so these cases run on the adapters that preserve both.
89
- %i[oga ox].each do |adapter|
88
+ # under rexml), so these cases run on the engine that preserves both.
89
+ %i[ox].each do |adapter|
90
90
  context "with the #{adapter} adapter" do
91
91
  it "keeps both spellings disjoint regardless of document order" do
92
92
  [both_spellings, both_spellings_plain_first].each do |xml|
@@ -116,7 +116,7 @@ RSpec.describe "Attribute namespace-disjoint parsing" do
116
116
  xmi_type: "uml:Parameter",
117
117
  plain_type: "EAnone_void",
118
118
  )
119
- reparsed = AttributeNamespaceDisjointnessSpec.parse(probe.to_xml, :oga)
119
+ reparsed = AttributeNamespaceDisjointnessSpec.parse(probe.to_xml, :ox)
120
120
 
121
121
  expect(reparsed.xmi_type).to eq("uml:Parameter")
122
122
  expect(reparsed.plain_type).to eq("EAnone_void")
@@ -192,30 +192,6 @@ RSpec.describe "XML Builder consistency" do
192
192
  it_behaves_like "a consistent XML builder"
193
193
  end
194
194
 
195
- describe "on :oga" do
196
- let(:engine) { :oga }
197
-
198
- it_behaves_like "a consistent XML builder"
199
-
200
- it "defaults namespace validation to lenient under Opal" do
201
- allow(Lutaml::Model::RuntimeCompatibility).to receive(:opal?)
202
- .and_return(true)
203
-
204
- builder = Lutaml::Xml::Builder::Base.build(engine: engine) do |xml|
205
- xml.create_and_add_element(
206
- "root",
207
- attributes: {
208
- "xmlns" => "-//OASIS//DTD XML Exchange Table Model 19990315//EN",
209
- },
210
- )
211
- end
212
-
213
- expect(builder.to_xml).to include(
214
- 'xmlns="-//OASIS//DTD XML Exchange Table Model 19990315//EN"',
215
- )
216
- end
217
- end
218
-
219
195
  describe "on :rexml" do
220
196
  let(:engine) { :rexml }
221
197