lutaml-model 0.8.201 → 0.8.203

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 (153) hide show
  1. checksums.yaml +4 -4
  2. data/.github/scripts/test_installed_gem.rb +1 -13
  3. data/.github/workflows/dependent-tests.yml +59 -2
  4. data/.github/workflows/downstream-performance.yml +1 -22
  5. data/.github/workflows/performance.yml +1 -33
  6. data/.github/workflows/rake.yml +2 -6
  7. data/.rubocop.yml +0 -10
  8. data/.rubocop_todo.yml +0 -4
  9. data/Gemfile +0 -23
  10. data/README.adoc +25 -86
  11. data/Rakefile +2 -167
  12. data/docs/_guides/advanced-mapping.adoc +6 -6
  13. data/docs/_guides/character-encoding.adoc +0 -3
  14. data/docs/_guides/gem-integration.adoc +1 -1
  15. data/docs/_guides/index.adoc +0 -4
  16. data/docs/_guides/xml/type-namespaces.adoc +1 -1
  17. data/docs/_guides/xml-guide-0.8.0.adoc +2 -2
  18. data/docs/_guides/xml-namespaces.adoc +2 -3
  19. data/docs/_guides/xml_mappings/03_architecture.adoc +2 -2
  20. data/docs/_guides/xml_mappings/07_best_practices.adoc +2 -3
  21. data/docs/_guides/xml_mappings/08_troubleshooting.adoc +1 -9
  22. data/docs/_pages/comparison-with-shale.adoc +1 -1
  23. data/docs/_pages/configuration.adoc +6 -40
  24. data/docs/_pages/index.adoc +0 -1
  25. data/docs/_pages/serialization_adapters.adoc +4 -16
  26. data/docs/_references/architecture.adoc +1 -1
  27. data/docs/_references/lutaml-namespace-planning.md +1 -1
  28. data/docs/_references/plan-schema-spec.adoc +45 -18
  29. data/docs/_references/three-phase-namespace-architecture.adoc +1 -2
  30. data/docs/_references/xsd-generation-with-namespace-support.adoc +3 -8
  31. data/docs/_tutorials/lutaml-xml-architecture.adoc +2 -8
  32. data/docs/architecture.md +7 -11
  33. data/docs/conversion_caching.adoc +1 -1
  34. data/docs/index.adoc +0 -1
  35. data/docs/key_value_data_model.adoc +1 -1
  36. data/docs/namespace-management.adoc +4 -10
  37. data/lib/lutaml/json/format.rb +0 -1
  38. data/lib/lutaml/json/generator_options.rb +0 -1
  39. data/lib/lutaml/key_value/transform.rb +149 -37
  40. data/lib/lutaml/lml/document_builder.rb +2 -2
  41. data/lib/lutaml/lml/entity_types.rb +2 -2
  42. data/lib/lutaml/model/adapter_resolver.rb +5 -15
  43. data/lib/lutaml/model/attribute.rb +11 -6
  44. data/lib/lutaml/model/cached_type_resolver.rb +1 -7
  45. data/lib/lutaml/model/error/unknown_adapter_type_error.rb +1 -1
  46. data/lib/lutaml/model/global_context.rb +3 -5
  47. data/lib/lutaml/model/instrumentation.rb +0 -3
  48. data/lib/lutaml/model/mapping/mapping_rule.rb +6 -10
  49. data/lib/lutaml/model/register.rb +20 -31
  50. data/lib/lutaml/model/runtime_compatibility.rb +0 -92
  51. data/lib/lutaml/model/schema/class_loader.rb +2 -4
  52. data/lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb +2 -3
  53. data/lib/lutaml/model/serialize/attribute_definition.rb +10 -184
  54. data/lib/lutaml/model/serialize/conversion_caching.rb +1 -5
  55. data/lib/lutaml/model/serialize/deserialization_context.rb +21 -0
  56. data/lib/lutaml/model/serialize/initialization.rb +19 -9
  57. data/lib/lutaml/model/serialize/model_import.rb +0 -5
  58. data/lib/lutaml/model/serialize/value_mapping.rb +0 -3
  59. data/lib/lutaml/model/services/rule_value_extractor.rb +4 -7
  60. data/lib/lutaml/model/store.rb +10 -17
  61. data/lib/lutaml/model/toml.rb +0 -2
  62. data/lib/lutaml/model/transformation_registry.rb +3 -7
  63. data/lib/lutaml/model/version.rb +1 -1
  64. data/lib/lutaml/model.rb +3 -19
  65. data/lib/lutaml/toml/format.rb +4 -8
  66. data/lib/lutaml/xml/adapter/moxml_adapter.rb +1 -7
  67. data/lib/lutaml/xml/adapter.rb +0 -4
  68. data/lib/lutaml/xml/adapter_loader.rb +1 -6
  69. data/lib/lutaml/xml/builder/base.rb +0 -3
  70. data/lib/lutaml/xml/builder.rb +0 -8
  71. data/lib/lutaml/xml/data_model.rb +1 -1
  72. data/lib/lutaml/xml/doctype_extractor.rb +3 -3
  73. data/lib/lutaml/xml/format.rb +22 -74
  74. data/lib/lutaml/xml/leptris/plan_compiler.rb +1 -2
  75. data/lib/lutaml/xml/model_transform.rb +14 -24
  76. data/lib/lutaml/xml/polymorphic_value_handler.rb +1 -1
  77. data/lib/lutaml/xml/schema/builder/moxml.rb +1 -1
  78. data/lib/lutaml/xml/schema/builder.rb +6 -9
  79. data/lib/lutaml/xml/schema/relaxng_schema.rb +1 -1
  80. data/lib/lutaml/xml/xml_element.rb +3 -2
  81. data/lib/lutaml/xml/xsd_validator.rb +4 -11
  82. data/lib/lutaml/yaml/adapter/yeptris_adapter.rb +2 -2
  83. data/lib/lutaml/yamls/adapter_loader.rb +1 -5
  84. data/lib/tasks/performance_comparator.rb +1 -1
  85. data/lutaml-model.gemspec +3 -8
  86. data/spec/address_person_spec.rb +8 -0
  87. data/spec/address_spec.rb +4 -0
  88. data/spec/benchmarks/xml_parsing_benchmark_spec.rb +1 -1
  89. data/spec/lutaml/json/adapter/standard_adapter_spec.rb +6 -9
  90. data/spec/lutaml/key_value/group_instantiate_spec.rb +204 -1
  91. data/spec/lutaml/model/adapter_resolver_yeptris_switch_spec.rb +0 -2
  92. data/spec/lutaml/model/cached_type_resolver_spec.rb +2 -54
  93. data/spec/lutaml/model/cdata_spec.rb +2 -15
  94. data/spec/lutaml/model/encoding_spec.rb +0 -9
  95. data/spec/lutaml/model/except_spec.rb +0 -7
  96. data/spec/lutaml/model/json_spec.rb +0 -14
  97. data/spec/lutaml/model/mixed_content_spec.rb +6 -46
  98. data/spec/lutaml/model/ordered_content_spec.rb +0 -7
  99. data/spec/lutaml/model/processing_instruction_spec.rb +0 -6
  100. data/spec/lutaml/model/runtime_compatibility_spec.rb +0 -37
  101. data/spec/lutaml/model/serializable_spec.rb +0 -2
  102. data/spec/lutaml/model/serialize/deserialization_context_spec.rb +68 -0
  103. data/spec/lutaml/model/toml_spec.rb +0 -23
  104. data/spec/lutaml/xml/adapter/base_adapter_regression_spec.rb +0 -4
  105. data/spec/lutaml/xml/adapter/order_spec.rb +1 -1
  106. data/spec/lutaml/xml/adapter/xml_namespace_spec.rb +0 -7
  107. data/spec/lutaml/xml/attribute_namespace_disjointness_spec.rb +6 -6
  108. data/spec/lutaml/xml/builder/builder_spec.rb +0 -24
  109. data/spec/lutaml/xml/default_namespace_spec.rb +1 -8
  110. data/spec/lutaml/xml/doctype_preservation_spec.rb +0 -4
  111. data/spec/lutaml/xml/entity_fragmentation_spec.rb +0 -6
  112. data/spec/lutaml/xml/fpi_namespace_spec.rb +0 -21
  113. data/spec/lutaml/xml/mapping_spec.rb +8 -15
  114. data/spec/lutaml/xml/namespace_scope_vcard_spec.rb +0 -7
  115. data/spec/lutaml/xml/namespace_spec.rb +0 -13
  116. data/spec/lutaml/xml/prefix_control_spec.rb +0 -6
  117. data/spec/lutaml/xml/schema/builder_moxml_spec.rb +1 -1
  118. data/spec/lutaml/xml/xml_adapter_spec.rb +0 -7
  119. data/spec/lutaml/xml/xml_spec.rb +2 -88
  120. data/spec/spec_helper.rb +8 -28
  121. data/spec/support/test_adapter_config.rb +6 -6
  122. metadata +2 -32
  123. data/.github/workflows/js-pr-check.yml +0 -106
  124. data/.github/workflows/js-sync.yml +0 -55
  125. data/.github/workflows/opal.yml +0 -65
  126. data/.gitmodules +0 -6
  127. data/.rspec-opal +0 -5
  128. data/docs/_guides/opal.adoc +0 -232
  129. data/lib/compat/opal/generate_boot.rb +0 -137
  130. data/lib/compat/opal/js_bundle_entry.rb +0 -42
  131. data/lib/compat/opal/lutaml_model_boot.rb +0 -638
  132. data/lib/compat/opal/monitor.rb +0 -31
  133. data/lib/compat/opal/moxml/adapter/customized_rexml/entity_reference.rb +0 -9
  134. data/lib/compat/opal/moxml/adapter/customized_rexml/formatter.rb +0 -225
  135. data/lib/compat/opal/moxml/adapter/customized_rexml.rb +0 -11
  136. data/lib/compat/opal/moxml_boot.rb +0 -68
  137. data/lib/compat/opal/objectspace_shim.rb +0 -23
  138. data/lib/compat/opal/rexml/namespace.rb +0 -59
  139. data/lib/compat/opal/rexml/parsers/baseparser.rb +0 -1016
  140. data/lib/compat/opal/rexml/source.rb +0 -214
  141. data/lib/compat/opal/rexml/text.rb +0 -426
  142. data/lib/compat/opal/rexml/xmltokens.rb +0 -45
  143. data/lib/compat/opal/rexml_compat.rb +0 -85
  144. data/lib/compat/opal/yaml_compat.rb +0 -32
  145. data/lib/lutaml/model/cached_type_resolver/mutex_hash_cache.rb +0 -53
  146. data/lib/lutaml/model/schema/schema_builder/oga.rb +0 -92
  147. data/lib/lutaml/xml/schema/builder/oga.rb +0 -92
  148. data/spec/lutaml/model/boot_manifest_spec.rb +0 -30
  149. data/spec/lutaml/model/opal_smoke_spec.rb +0 -199
  150. data/spec/lutaml/model/serialize/attribute_definition_block_form_spec.rb +0 -244
  151. data/spec/lutaml/xml/adapter/oga_adapter_spec.rb +0 -135
  152. data/spec/lutaml/xml/opal_xml_spec.rb +0 -204
  153. data/spec/support/opal.rb +0 -9
@@ -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
 
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ # #1311 lever 3: the propagated child options are a per-node constant.
6
+ # child_options memoizes them on the node's cast-options hash so the
7
+ # slice + merge pair runs once per node instead of once per attribute
8
+ # with a child value.
9
+ RSpec.describe Lutaml::Model::Serialize::DeserializationContext do
10
+ let(:parent_model) { Struct.new(:name).new("parent") }
11
+ let(:options) do
12
+ {
13
+ lutaml_parent: parent_model,
14
+ lutaml_root: parent_model,
15
+ default_namespace: "urn:example",
16
+ namespace_uri: "urn:internal",
17
+ resolved_type: String,
18
+ arbitrary: "ignored",
19
+ }
20
+ end
21
+
22
+ describe ".child_options" do
23
+ it "extracts only the propagable keys" do
24
+ child = described_class.child_options(options, :default)
25
+
26
+ expect(child[:lutaml_parent]).to equal(parent_model)
27
+ expect(child[:lutaml_root]).to equal(parent_model)
28
+ expect(child[:default_namespace]).to eq("urn:example")
29
+ expect(child[:register]).to eq(:default)
30
+ expect(child).not_to have_key(:namespace_uri)
31
+ expect(child).not_to have_key(:resolved_type)
32
+ expect(child).not_to have_key(:arbitrary)
33
+ end
34
+
35
+ it "returns the same hash for repeat calls under one register" do
36
+ first = described_class.child_options(options, :default)
37
+ second = described_class.child_options(options, :default)
38
+
39
+ expect(second).to equal(first)
40
+ end
41
+
42
+ it "recomputes when the register differs" do
43
+ first = described_class.child_options(options, :default)
44
+ other = described_class.child_options(options, :other)
45
+
46
+ expect(other[:register]).to eq(:other)
47
+ expect(other).not_to equal(first)
48
+ expect(described_class.child_options(options, :default)[:register])
49
+ .to eq(:default)
50
+ end
51
+
52
+ it "never propagates its own memo key to children" do
53
+ child = described_class.child_options(options, :default)
54
+
55
+ expect(child).not_to have_key(
56
+ Lutaml::Model::Serialize::DeserializationContext::CHILD_OPTIONS_KEY,
57
+ )
58
+ end
59
+
60
+ it "computes without mutating frozen options" do
61
+ frozen = options.dup.freeze
62
+ child = described_class.child_options(frozen, :default)
63
+
64
+ expect(child[:register]).to eq(:default)
65
+ expect(described_class.child_options(frozen, :default)).not_to equal(child)
66
+ end
67
+ end
68
+ end
@@ -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
 
@@ -95,7 +95,7 @@ RSpec.describe DefaultNamespaceSpec do
95
95
  # and namespace has element_form_default: :unqualified (W3C default),
96
96
  # so child is in BLANK namespace and MUST declare xmlns="".
97
97
  #
98
- # All adapters (Nokogiri, Ox, Oga) now correctly add xmlns=""
98
+ # All adapters (Nokogiri, Ox) now correctly add xmlns=""
99
99
  # to explicitly place child in blank namespace.
100
100
  expect(xml).to include('xmlns="http://example.com/ns"')
101
101
  expect(xml).to include('<child xmlns="">Content</child>')
@@ -179,11 +179,4 @@ RSpec.describe DefaultNamespaceSpec do
179
179
  described_class
180
180
  end
181
181
  end
182
-
183
- describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga) do
184
- if TestAdapterConfig.adapter_enabled?(:oga)
185
- it_behaves_like "default namespace serialization",
186
- described_class
187
- end
188
- end
189
182
  end
@@ -316,8 +316,4 @@ RSpec.describe "DOCTYPE Preservation Issue #2" do
316
316
  describe "with Ox adapter" do
317
317
  it_behaves_like "DOCTYPE preservation", :ox
318
318
  end
319
-
320
- describe "with Oga adapter" do
321
- it_behaves_like "DOCTYPE preservation", :oga
322
- end
323
319
  end
@@ -563,12 +563,6 @@ RSpec.describe "XML Entity Fragmentation Issue #5" do
563
563
  end
564
564
  end
565
565
 
566
- describe "with Oga adapter" do
567
- if TestAdapterConfig.adapter_enabled?(:oga)
568
- it_behaves_like "XML entity preservation", :oga
569
- end
570
- end
571
-
572
566
  describe "with Ox adapter" do
573
567
  if TestAdapterConfig.adapter_enabled?(:ox)
574
568
  it_behaves_like "XML entity preservation", :ox
@@ -69,27 +69,6 @@ RSpec.describe "FPI Namespace Handling" do
69
69
  end
70
70
  end
71
71
 
72
- context "with Oga adapter" do
73
- before(:all) do
74
- Lutaml::Model::Config.xml_adapter_type = :oga
75
- end
76
-
77
- it "converts FPI namespace to URN on serialization" do
78
- xml = <<~XML
79
- <table xmlns="-//OASIS//DTD XML Exchange Table Model 19990315//EN">
80
- <entry>Data</entry>
81
- </table>
82
- XML
83
-
84
- adapter_class = Lutaml::Model::Config.xml_adapter
85
- doc = adapter_class.parse(xml)
86
-
87
- output = doc.to_xml
88
-
89
- expect(output).to include("urn:publicid:-//OASIS//DTD+XML+Exchange+Table+Model+19990315//EN")
90
- end
91
- end
92
-
93
72
  context "helper methods in BaseAdapter" do
94
73
  before(:all) do
95
74
  # Use any adapter to test the class methods
@@ -624,7 +624,7 @@ RSpec.describe Lutaml::Xml::Mapping do
624
624
  serialized = parsed.to_xml
625
625
 
626
626
  # Different adapters have different hoisting behaviors:
627
- # - Nokogiri/Oga: Hoists namespace to parent
627
+ # - Nokogiri: Hoists namespace to parent
628
628
  # - Ox: No namespace declaration (uses inline xmi prefix without xmlns)
629
629
  expected = if adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox)
630
630
  # Ox doesn't add xmlns declaration when model has no namespace
@@ -634,7 +634,7 @@ RSpec.describe Lutaml::Xml::Mapping do
634
634
  </ownedComment>
635
635
  XML
636
636
  else
637
- # Nokogiri/Oga hoist the namespace
637
+ # Nokogiri hoists the namespace
638
638
  xml_with_element_hoisted.strip
639
639
  end
640
640
  expect(serialized).to be_xml_equivalent_to(expected)
@@ -653,7 +653,7 @@ RSpec.describe Lutaml::Xml::Mapping do
653
653
  serialized = parsed.to_xml
654
654
 
655
655
  # Different adapters have different hoisting behaviors:
656
- # - Nokogiri/Oga: Hoists namespace to parent
656
+ # - Nokogiri: Hoists namespace to parent
657
657
  # - Ox: No namespace declaration (uses inline xmi prefix without xmlns)
658
658
  expected = if adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox)
659
659
  # Ox doesn't add xmlns declaration when model has no namespace
@@ -663,7 +663,7 @@ RSpec.describe Lutaml::Xml::Mapping do
663
663
  </ownedComment>
664
664
  XML
665
665
  else
666
- # Nokogiri/Oga hoist the namespace
666
+ # Nokogiri hoists the namespace
667
667
  xml_with_same_name_attribute_and_element_hoisted
668
668
  end
669
669
  expect(serialized).to be_xml_equivalent_to(expected)
@@ -704,7 +704,7 @@ RSpec.describe Lutaml::Xml::Mapping do
704
704
  </SameElementName>
705
705
  XML
706
706
  else
707
- # Nokogiri/Oga: CityGML preserves PREFIX format, GML uses DEFAULT
707
+ # Nokogiri: CityGML preserves PREFIX format, GML uses DEFAULT
708
708
  <<~XML
709
709
  <SameElementName xmlns="http://www.omg.org/spec/XMI/20131001" App="hello">
710
710
  <ApplicationSchema xmlns="http://www.sparxsystems.com/profiles/GML/1.0">GML App</ApplicationSchema>
@@ -801,7 +801,7 @@ RSpec.describe Lutaml::Xml::Mapping do
801
801
  it "reads element without namespace" do
802
802
  # NOTE: mapping with namespace: nil, prefix: nil has differing adapter behavior:
803
803
  # - Nokogiri: Cannot parse element with parent namespace prefix, returns nil
804
- # - Ox/Oga: Can parse element with parent namespace prefix successfully
804
+ # - Ox: Can parse element with parent namespace prefix successfully
805
805
  if adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:nokogiri)
806
806
  expect(parsed.without_namespace).to be_nil
807
807
  else
@@ -820,7 +820,7 @@ RSpec.describe Lutaml::Xml::Mapping do
820
820
  expect(reparsed.with_default_namespace).to eq("default namespace text")
821
821
  expect(reparsed.with_namespace.value).to eq("explicit namespace text")
822
822
  else
823
- # Ox/Oga can parse the element successfully
823
+ # Ox can parse the element successfully
824
824
  # When parent has element_form_default: :qualified (ParentNamespace has this),
825
825
  # children without explicit namespace inherit parent's namespace.
826
826
  # WithoutNamespaceElement has no namespace declaration, so it inherits.
@@ -917,7 +917,7 @@ RSpec.describe Lutaml::Xml::Mapping do
917
917
  # instead of prefix format for child elements with different namespaces.
918
918
  # Both are W3C compliant.
919
919
  let(:expected_xml) do
920
- # Ox uses prefix format, Nokogiri/Oga use default format
920
+ # Ox uses prefix format, Nokogiri uses default format
921
921
  if adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox)
922
922
  <<~XML
923
923
  <ChildNamespaceNil xmlns="http://www.omg.org/spec/XMI/20131001">
@@ -1134,13 +1134,6 @@ RSpec.describe Lutaml::Xml::Mapping do
1134
1134
  end
1135
1135
  end
1136
1136
 
1137
- describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga) do
1138
- if TestAdapterConfig.adapter_enabled?(:oga)
1139
- it_behaves_like "having XML Mappings",
1140
- described_class
1141
- end
1142
- end
1143
-
1144
1137
  describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:rexml) do
1145
1138
  if TestAdapterConfig.adapter_enabled?(:rexml)
1146
1139
  it_behaves_like "having XML Mappings", described_class
@@ -597,13 +597,6 @@ RSpec.describe "namespace_scope with vCard" do
597
597
  end
598
598
  end
599
599
 
600
- context "with Oga adapter" do
601
- if TestAdapterConfig.adapter_enabled?(:oga)
602
- it_behaves_like "namespace_scope behavior",
603
- Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga)
604
- end
605
- end
606
-
607
600
  context "with REXML adapter" do
608
601
  if TestAdapterConfig.adapter_enabled?(:rexml)
609
602
  it_behaves_like "namespace_scope behavior",
@@ -685,19 +685,6 @@ RSpec.describe "XML Namespace Handling" do
685
685
  it_behaves_like "namespace inheritance behavior"
686
686
  end
687
687
 
688
- describe "with Oga adapter" do
689
- around do |example|
690
- Lutaml::Model::Config.xml_adapter_type = :oga
691
- example.run
692
- end
693
-
694
- after(:all) do
695
- Lutaml::Model::Config.xml_adapter_type = :nokogiri
696
- end
697
-
698
- it_behaves_like "namespace inheritance behavior"
699
- end
700
-
701
688
  describe "with REXML adapter" do
702
689
  if TestAdapterConfig.adapter_enabled?(:rexml)
703
690
  around do |example|
@@ -268,12 +268,6 @@ RSpec.describe "XML Prefix Control" do
268
268
  end
269
269
  end
270
270
 
271
- context "with Oga adapter" do
272
- if TestAdapterConfig.adapter_enabled?(:oga)
273
- it_behaves_like "prefix control behavior", Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga)
274
- end
275
- end
276
-
277
271
  context "with REXML adapter" do
278
272
  if TestAdapterConfig.adapter_enabled?(:rexml)
279
273
  it_behaves_like "prefix control behavior",
@@ -4,7 +4,7 @@ require "spec_helper"
4
4
 
5
5
  RSpec.describe Lutaml::Xml::Schema::Builder do
6
6
  # issue #1184: schema generation rides the CONFIGURED engine through
7
- # the moxml layer. The dedicated Nokogiri/Oga wrappers keep their
7
+ # the moxml layer. The dedicated Nokogiri wrapper keeps its
8
8
  # lanes; every other engine (ox, leptris, rexml) generates through
9
9
  # the Moxml wrapper instead of silently substituting Nokogiri.
10
10
 
@@ -238,13 +238,6 @@ RSpec.describe "XmlAdapter" do
238
238
  end
239
239
  end
240
240
 
241
- describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga) do
242
- if TestAdapterConfig.adapter_enabled?(:oga)
243
- it_behaves_like "an XML adapter",
244
- described_class
245
- end
246
- end
247
-
248
241
  describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:rexml) do
249
242
  if TestAdapterConfig.adapter_enabled?(:rexml)
250
243
  it_behaves_like "an XML adapter",
@@ -34,82 +34,8 @@ RSpec.describe Lutaml::Xml do
34
34
  end
35
35
 
36
36
  describe "schema autoloads" do
37
- it "matches native-only schema autoload availability" do
38
- expect(described_class::Schema.const_defined?(:Xsd, false))
39
- .to be(!Lutaml::Model::RuntimeCompatibility.opal?)
40
- end
41
-
42
- it "does not autoload schema constants when loaded under Opal" do
43
- script = <<~'RUBY'
44
- require "lutaml/model/runtime_compatibility"
45
-
46
- module Lutaml
47
- module Model
48
- module RuntimeCompatibility
49
- def self.opal?
50
- true
51
- end
52
- end
53
- end
54
- end
55
-
56
- require "lutaml/xml/schema"
57
-
58
- schema_constants = %i[
59
- Xsd XsdSchema RelaxngSchema Builder BuiltinTypes
60
- ]
61
-
62
- loaded_constants = schema_constants.select do |constant_name|
63
- Lutaml::Xml::Schema.autoload?(constant_name) ||
64
- Lutaml::Xml::Schema.const_defined?(constant_name, false)
65
- end
66
-
67
- if loaded_constants.any?
68
- abort "loaded schema constants: #{loaded_constants.join(', ')}"
69
- end
70
-
71
- puts :ok
72
- RUBY
73
-
74
- result, status = run_ruby(script)
75
-
76
- expect(status.success?).to be(true), result
77
- expect(result).to include("ok")
78
- end
79
- end
80
-
81
- describe "schema methods" do
82
- before do
83
- allow(Lutaml::Model::RuntimeCompatibility).to receive(:opal?)
84
- .and_return(true)
85
- end
86
-
87
- it "raises NotImplementedError for XSD generation under Opal" do
88
- expect do
89
- Lutaml::Model::Schema.to_xsd(Object)
90
- end.to raise_error(
91
- NotImplementedError,
92
- "XSD schema generation is not available under Opal.",
93
- )
94
- end
95
-
96
- it "raises NotImplementedError for RELAX NG generation under Opal" do
97
- expect do
98
- Lutaml::Model::Schema.to_relaxng(Object)
99
- end.to raise_error(
100
- NotImplementedError,
101
- "RELAX NG schema generation requires Nokogiri, " \
102
- "which is not available under Opal.",
103
- )
104
- end
105
-
106
- it "raises NotImplementedError for XML schema compilation under Opal" do
107
- expect do
108
- Lutaml::Model::Schema.from_xml("<schema/>")
109
- end.to raise_error(
110
- NotImplementedError,
111
- "XML schema compilation is not available under Opal.",
112
- )
37
+ it "registers the schema constant autoloads" do
38
+ expect(described_class::Schema.const_defined?(:Xsd, false)).to be(true)
113
39
  end
114
40
  end
115
41
 
@@ -118,7 +44,6 @@ RSpec.describe Lutaml::Xml do
118
44
  # Hide any existing constants first
119
45
  hide_const("Nokogiri") if Object.const_defined?(:Nokogiri)
120
46
  hide_const("Ox") if Object.const_defined?(:Ox)
121
- hide_const("Oga") if Object.const_defined?(:Oga)
122
47
  hide_const("REXML") if Object.const_defined?(:REXML)
123
48
  # When the leptris gem is in the bundle, moxml prefers it over every
124
49
  # other engine; the legacy-detection contexts below must opt out to
@@ -155,16 +80,6 @@ RSpec.describe Lutaml::Xml do
155
80
  end
156
81
  end
157
82
 
158
- context "when Oga is available" do
159
- before do
160
- stub_const("Oga", Module.new)
161
- end
162
-
163
- it "returns :oga" do
164
- expect(described_class.detect_xml_adapter).to eq(:oga)
165
- end
166
- end
167
-
168
83
  context "when no adapters are detected" do
169
84
  it "falls back to moxml default (:nokogiri)" do
170
85
  expect(described_class.detect_xml_adapter).to eq(:nokogiri)
@@ -175,7 +90,6 @@ RSpec.describe Lutaml::Xml do
175
90
  before do
176
91
  stub_const("Nokogiri", Module.new)
177
92
  stub_const("Ox", Module.new)
178
- stub_const("Oga", Module.new)
179
93
  end
180
94
 
181
95
  it "prefers Nokogiri" do