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
data/Rakefile CHANGED
@@ -2,68 +2,14 @@
2
2
 
3
3
  require "bundler/gem_tasks"
4
4
 
5
- # vendor:prepare must be runnable before `bundle install` (CI runs it
6
- # first so the path-source oga/ruby-ll forks' gitignored lexer/parser
7
- # outputs exist before their extconf.rb runs). Guard the rspec/opal
8
- # requires so the file loads with only `rake` + `bundler` available.
5
+ # Guard the rspec/rubocop requires so the file loads with only `rake` +
6
+ # `bundler` available.
9
7
  begin
10
8
  require "rspec/core/rake_task"
11
9
  RSpec::Core::RakeTask.new(:spec)
12
10
  rescue LoadError
13
11
  end
14
12
 
15
- begin
16
- require "opal/rspec/rake_task"
17
-
18
- # Opal-compatible overrides need to be on Opal's global load path so
19
- # the compiler can follow `require "lutaml_model_boot"` etc.
20
- # moxml ships its own compat files (`lib/compat/opal/`) inside the gem;
21
- # we add moxml's gem dir to Opal's load path so we can reuse them.
22
- # moxml's lib root is also added so `require "moxml"` resolves.
23
- #
24
- # The REXML gem is a bundled Ruby stdlib gem (pure Ruby). moxml's
25
- # lib/compat/opal/rexml/* shadows patch its namespace/text/source/etc.
26
- # for Opal. For `require "rexml/document"` and friends to resolve, the
27
- # gem's lib dir must be on Opal's load path (mirrors what moxml does).
28
- if defined?(Opal)
29
- Opal.append_path File.expand_path("lib/compat/opal", __dir__)
30
-
31
- moxml_gem_dir = Gem::Specification.find_by_name("moxml")&.gem_dir
32
- if moxml_gem_dir
33
- Opal.append_path File.join(moxml_gem_dir, "lib")
34
- # moxml 0.5 shipped lib/compat/opal (rexml shadows for the boot);
35
- # the 0.6 line no longer carries it — append only when present so
36
- # the boot works on both lines.
37
- compat_dir = File.join(moxml_gem_dir, "lib/compat/opal")
38
- Opal.append_path compat_dir if File.directory?(compat_dir)
39
- end
40
-
41
- # parsanol (the subsumed LML grammar machinery) is pure Ruby; its
42
- # gem lib must be on Opal's load path for the boot's
43
- # `require "parsanol"` to resolve.
44
- parsanol_gem_dir = Gem::Specification.find_by_name("parsanol")&.gem_dir
45
- Opal.append_path File.join(parsanol_gem_dir, "lib") if parsanol_gem_dir
46
-
47
- rexml_lib = $LOAD_PATH.find do |p|
48
- File.exist?(File.join(p, "rexml", "document.rb"))
49
- end
50
- Opal.append_path rexml_lib if rexml_lib
51
-
52
- # The Opal-compatible oga and ruby-ll forks (vendored as submodules)
53
- # expose pure-Ruby implementations under ext/pureruby/. Their top-level
54
- # lib/oga.rb and lib/ll/setup.rb conditionally require them when
55
- # RUBY_PLATFORM == 'opal'. Both lib/ and ext/pureruby/ must be on
56
- # Opal's load path so the conditional resolves correctly.
57
- %w[opal-oga opal-ruby-ll].each do |fork_name|
58
- fork_path = File.expand_path("vendor/#{fork_name}", __dir__)
59
- Opal.append_path File.join(fork_path, "lib")
60
- Opal.append_path File.join(fork_path, "ext/pureruby")
61
- end
62
- end
63
- rescue LoadError
64
- # Opal not available or incompatible with current Ruby version
65
- end
66
-
67
13
  begin
68
14
  require "rubocop/rake_task"
69
15
  RuboCop::RakeTask.new
@@ -72,115 +18,4 @@ end
72
18
 
73
19
  Dir.glob("lib/tasks/**/*.rake").each { |r| load r }
74
20
 
75
- # Regenerate the ragel / ruby-ll outputs that the Opal-compatible forks
76
- # (vendored as submodules under vendor/) gitignore. The forks ship the
77
- # grammar sources (.rl / .rll) but not the generated .rb / .c, since
78
- # those are large and version-controllable upstream. Both ragel and
79
- # ruby-ll must be on PATH; the upstream ruby-ll gem is sufficient for
80
- # generation (the fork is only needed at runtime).
81
- namespace :vendor do
82
- desc "Generate ragel / ruby-ll outputs in vendored opal-oga and opal-ruby-ll"
83
- task :prepare do
84
- require "fileutils"
85
-
86
- oga = File.expand_path("vendor/opal-oga", __dir__)
87
- ruby_ll = File.expand_path("vendor/opal-ruby-ll", __dir__)
88
-
89
- generators = [
90
- # oga: ruby-ll grammar -> Ruby parser
91
- ["ruby-ll #{oga}/lib/oga/xml/parser.rll -o #{oga}/lib/oga/xml/parser.rb",
92
- "#{oga}/lib/oga/xml/parser.rb",
93
- "#{oga}/lib/oga/xml/parser.rll"],
94
- ["ruby-ll #{oga}/lib/oga/xpath/parser.rll -o #{oga}/lib/oga/xpath/parser.rb",
95
- "#{oga}/lib/oga/xpath/parser.rb",
96
- "#{oga}/lib/oga/xpath/parser.rll"],
97
- ["ruby-ll #{oga}/lib/oga/css/parser.rll -o #{oga}/lib/oga/css/parser.rb",
98
- "#{oga}/lib/oga/css/parser.rb",
99
- "#{oga}/lib/oga/css/parser.rll"],
100
- # oga: ragel Ruby lexer
101
- ["ragel -R -F1 #{oga}/lib/oga/xpath/lexer.rl -o #{oga}/lib/oga/xpath/lexer.rb",
102
- "#{oga}/lib/oga/xpath/lexer.rb",
103
- "#{oga}/lib/oga/xpath/lexer.rl"],
104
- ["ragel -R -F1 #{oga}/lib/oga/css/lexer.rl -o #{oga}/lib/oga/css/lexer.rb",
105
- "#{oga}/lib/oga/css/lexer.rb",
106
- "#{oga}/lib/oga/css/lexer.rl"],
107
- # oga: ragel C lexer for liboga
108
- ["ragel -C -I #{oga}/ext/ragel -G2 #{oga}/ext/c/lexer.rl -o #{oga}/ext/c/lexer.c",
109
- "#{oga}/ext/c/lexer.c",
110
- "#{oga}/ext/c/lexer.rl"],
111
- # ruby-ll: ruby-ll grammar -> Ruby parser
112
- ["ruby-ll #{ruby_ll}/lib/ll/parser.rll -o #{ruby_ll}/lib/ll/parser.rb --no-requires",
113
- "#{ruby_ll}/lib/ll/parser.rb",
114
- "#{ruby_ll}/lib/ll/parser.rll"],
115
- ]
116
-
117
- generators.each do |cmd, output, source|
118
- if File.exist?(output) && File.mtime(output) >= File.mtime(source)
119
- next
120
- end
121
-
122
- FileUtils.mkdir_p(File.dirname(output))
123
- sh cmd
124
- end
125
- end
126
-
127
- # Bundler does not reliably compile native extensions for path-source
128
- # gems. Build liboga/libll explicitly so `require "oga"` resolves.
129
- desc "Compile liboga / libll native extensions for vendored forks"
130
- task :compile do
131
- require "fileutils"
132
- require "rbconfig"
133
-
134
- dlext = RbConfig::CONFIG["DLEXT"]
135
-
136
- {
137
- "vendor/opal-ruby-ll" => "libll",
138
- "vendor/opal-oga" => "liboga",
139
- }.each do |fork_path, ext_name|
140
- abs_fork = File.expand_path(fork_path, __dir__)
141
- lib_bundle = File.join(abs_fork, "lib", "#{ext_name}.#{dlext}")
142
- ext_dir = File.join(abs_fork, "ext", "c")
143
- extconf = File.join(ext_dir, "extconf.rb")
144
- lib_dir = File.join(abs_fork, "lib")
145
- next if File.exist?(lib_bundle)
146
-
147
- Dir.chdir(ext_dir) do
148
- sh "ruby #{extconf}"
149
- sh "make"
150
- FileUtils.cp("#{ext_name}.#{dlext}", lib_dir)
151
- end
152
- end
153
- end
154
- end
155
-
156
- if defined?(RSpec)
157
- namespace :spec do
158
- if defined?(Opal::RSpec::RakeTask)
159
- desc "Run Opal (JavaScript) tests"
160
- Opal::RSpec::RakeTask.new(:opal) do |server, runner|
161
- server.append_path "lib"
162
- server.append_path "spec"
163
-
164
- runner.default_path = "spec"
165
- # Load order matters:
166
- # rexml_compat — moxml stdlib shim (String/Encoding/StringIO) required by Oga
167
- # yaml_compat — adds YAML.safe_load / YAML.dump on top of Opal's nodejs/yaml
168
- # oga, ll/setup — forks' Opal-aware conditionals select pure-Ruby lexer
169
- # moxml_boot — eager-loads Moxml::* (lutaml-model's copy, skips broken REXML paths in moxml 0.1.25)
170
- # lutaml_model_boot — eager-loads Lutaml::* (Opal ignores autoload)
171
- # spec_helper, support/opal — test infrastructure
172
- runner.requires = %w[rexml_compat yaml_compat
173
- oga ll/setup
174
- moxml_boot
175
- lutaml_model_boot
176
- spec_helper support/opal]
177
- runner.files = Dir.glob("spec/lutaml/**/opal*_spec.rb")
178
- end
179
-
180
- desc "Alias for spec:opal that also runs vendor:prepare"
181
- task opal: "vendor:prepare"
182
- end
183
- end
184
- end
185
-
186
21
  task default: %i[spec rubocop]
@@ -383,20 +383,20 @@ NOTE: For `NokogiriAdapter`, we can also call `to_xml` on `value.node.adapter_no
383
383
  # @namespace_prefix=nil,
384
384
  # @text=nil>
385
385
 
386
- # Oga Adapter Node
386
+ # Adapter Node
387
387
 
388
- # <Lutaml::Model::Xml::Oga::Element:0x0000000107314158
388
+ # <Lutaml::Xml::AdapterElement:0x0000000107314158
389
389
  # @attributes={},
390
390
  # @children=
391
- # [#<Lutaml::Model::Xml::Oga::Element:0x0000000107314090 @attributes={}, @children=[], @default_namespace=nil, @name="text", @namespace_prefix=nil, @text="\n ">,
392
- # #<Lutaml::Model::Xml::Oga::Element:0x000000010730fe78
391
+ # [#<Lutaml::Xml::AdapterElement:0x0000000107314090 @attributes={}, @children=[], @default_namespace=nil, @name="text", @namespace_prefix=nil, @text="\n ">,
392
+ # #<Lutaml::Xml::AdapterElement:0x000000010730fe78
393
393
  # @attributes={},
394
- # @children=[#<Lutaml::Model::Xml::Oga::Element:0x000000010730fd88 @attributes={}, @children=[], @default_namespace=nil, @name="text", @namespace_prefix=nil, @text="Metadata">],
394
+ # @children=[#<Lutaml::Xml::AdapterElement:0x000000010730fd88 @attributes={}, @children=[], @default_namespace=nil, @name="text", @namespace_prefix=nil, @text="Metadata">],
395
395
  # @default_namespace=nil,
396
396
  # @name="category",
397
397
  # @namespace_prefix=nil,
398
398
  # @text="Metadata">,
399
- # #<Lutaml::Model::Xml::Oga::Element:0x000000010730f8d8 @attributes={}, @children=[], @default_namespace=nil, @name="text", @namespace_prefix=nil, @text="\n ">],
399
+ # #<Lutaml::Xml::AdapterElement:0x000000010730f8d8 @attributes={}, @children=[], @default_namespace=nil, @name="text", @namespace_prefix=nil, @text="\n ">],
400
400
  # @default_namespace=nil,
401
401
  # @name="metadata",
402
402
  # @namespace_prefix=nil,
@@ -25,9 +25,6 @@ on the adapter used.
25
25
  ** Nokogiri: `UTF-8`. The encoding is set to the default encoding of the Nokogiri library,
26
26
  which is `UTF-8`.
27
27
 
28
- ** Oga: `UTF-8`. The encoding is set to the default encoding of the Oga library, which
29
- uses `UTF-8`.
30
-
31
28
  ** Ox: `ASCII-8bit`. The encoding is set to the default encoding of the Ox library, which uses
32
29
  `ASCII-8bit`.
33
30
 
@@ -18,7 +18,7 @@ compatible engines) cover a working default everywhere.
18
18
  spec.add_dependency "lutaml-model", "~> 0.8"
19
19
  ----
20
20
 
21
- Do not add Nokogiri, Ox, Oga, leptris, yeptris, or teptris to your
21
+ Do not add Nokogiri, Ox, leptris, yeptris, or teptris to your
22
22
  gemspec. All engines are optional at runtime:
23
23
 
24
24
  * when an engine gem is in the end user's bundle, the matching
@@ -62,10 +62,6 @@ See link:../references/rdf-namespaces[RDF Namespaces] for namespace classes,
62
62
  * link:../consolidation-mapping[Consolidation Mapping] - Group sibling elements into structured models
63
63
  * link:../document-validation[Document Validation] - Document-level validation with rules, profiles, and remediation
64
64
 
65
- == Runtime environments
66
-
67
- * link:../opal[Opal Usage Guide] - Run Lutaml::Model in the browser via Opal (Ruby to JavaScript)
68
-
69
65
  == By task
70
66
 
71
67
  === I want to serialize to XML
@@ -958,7 +958,7 @@ As of Session 197 (2026-01-01), Type namespace handling follows the "Dumb Adapte
958
958
 
959
959
  This architecture ensures:
960
960
 
961
- * **Consistency**: Same logic across all adapters (Nokogiri, Oga, Ox)
961
+ * **Consistency**: Same logic across all adapters (Nokogiri, Ox)
962
962
  * **Testability**: Planning and rendering can be tested independently
963
963
  * **Maintainability**: Type namespace features added in one place only
964
964
  * **No Duplication**: xmlns filtering prevents redundant declarations
@@ -740,7 +740,7 @@ IMPORTANT: The `prefix:` option only affects qualified elements. Unqualified ele
740
740
 
741
741
  === Overview
742
742
 
743
- Lutaml::Model 0.8.0 implements a sophisticated three-phase namespace architecture that ensures optimal xmlns declarations while maintaining W3C XML Namespace compliance across all XML adapters (Nokogiri, Ox, Oga).
743
+ Lutaml::Model 0.8.0 implements a sophisticated three-phase namespace architecture that ensures optimal xmlns declarations while maintaining W3C XML Namespace compliance across all XML adapters (Nokogiri, Ox).
744
744
 
745
745
  This architecture guarantees consistent namespace behavior regardless of which underlying XML library is used.
746
746
 
@@ -854,7 +854,7 @@ All XML adapters use the three-phase architecture via consistent interfaces:
854
854
  **Consistency guarantees**:
855
855
 
856
856
  * **Same model + same options = same XML**: Deterministic output
857
- * **Adapter-independent**: Nokogiri, Ox, and Oga produce identical xmlns patterns
857
+ * **Adapter-independent**: Nokogiri and Ox produce identical xmlns patterns
858
858
  * **W3C compliant**: All output follows XML Namespace specifications
859
859
 
860
860
  === Benefits
@@ -284,7 +284,6 @@ All three XML adapters support format preservation:
284
284
 
285
285
  * **Nokogiri** - Full support ✅
286
286
  * **Ox** - Full support ✅
287
- * **Oga** - Full support ✅
288
287
 
289
288
 
290
289
  ==== Elements in blank namespace
@@ -349,7 +348,7 @@ Per W3C XML Namespace specification, unprefixed elements normally inherit their
349
348
  parent's default namespace. The `xmlns=""` declaration explicitly removes that
350
349
  inheritance.
351
350
 
352
- **Parsing support**: All three adapters (Nokogiri, Ox, Oga) correctly handle both patterns.
351
+ **Parsing support**: All three adapters (Nokogiri, Ox) correctly handle both patterns.
353
352
  ====
354
353
 
355
354
  [[namespace-priority-system]]
@@ -2460,7 +2459,7 @@ declarations.
2460
2459
 
2461
2460
  When you parse XML that has an FPI in a namespace position, the parsing will succeed
2462
2461
  because the underlying XML parser can store the value. However, when serializing back to XML,
2463
- the underlying parser (Nokogiri, Oga, Ox, REXML) will reject the FPI as an invalid
2462
+ the underlying parser (Nokogiri, Ox, REXML) will reject the FPI as an invalid
2464
2463
  namespace URI:
2465
2464
 
2466
2465
  [source]
@@ -96,7 +96,7 @@ parent: XML Mappings Guide
96
96
  │ ▼ │
97
97
  │ ┌───────────────────────────────────────────────────────────┐ │
98
98
  │ │ Schema::SchemaBuilder │ │
99
- │ │ Adapters: Nokogiri, Oga │ │
99
+ │ │ Adapters: Nokogiri │ │
100
100
  │ └───────────────────────────────────────────────────────────┘ │
101
101
  │ │
102
102
  └───────────────────────────────────────────────────────────────────┘
@@ -202,4 +202,4 @@ generation engine that infers element/type structure and applies namespace
202
202
  metadata.
203
203
 
204
204
  `Schema::SchemaBuilder`::
205
- Adapter-based XSD serialization supporting Nokogiri and Oga.
205
+ Adapter-based XSD serialization supporting Nokogiri.
@@ -723,15 +723,14 @@ end
723
723
 
724
724
  * **Ox**: Fastest, use for performance-critical applications
725
725
  * **Nokogiri**: Most compatible, good balance
726
- * **Oga**: Pure Ruby, use when no native extensions allowed
727
- * **REXML**: Pure Ruby (bundled with Ruby), Opal-compatible
726
+ * **REXML**: Pure Ruby (bundled with Ruby)
728
727
 
729
728
  **Configure once:**
730
729
 
731
730
  [source,ruby]
732
731
  ----
733
732
  Lutaml::Model::Config.configure do |config|
734
- config.xml_adapter_type = :ox # or :nokogiri, :oga
733
+ config.xml_adapter_type = :ox # or :nokogiri
735
734
  end
736
735
  ----
737
736
 
@@ -283,7 +283,7 @@ Configure XML adapter before use:
283
283
  ----
284
284
  # Add this to your initialization code
285
285
  Lutaml::Model::Config.configure do |config|
286
- config.xml_adapter_type = :nokogiri # or :ox, :oga
286
+ config.xml_adapter_type = :nokogiri # or :ox
287
287
  end
288
288
  ----
289
289
 
@@ -782,10 +782,6 @@ Lutaml::Model::Config.configure do |config|
782
782
  config.xml_adapter_type = :nokogiri
783
783
  end
784
784
 
785
- # Oga is pure Ruby (slowest but no native deps)
786
- Lutaml::Model::Config.configure do |config|
787
- config.xml_adapter_type = :oga
788
- end
789
785
  ----
790
786
 
791
787
  === Large memory usage
@@ -905,10 +901,6 @@ Install required gem:
905
901
  gem install ox
906
902
  # or add to Gemfile: gem 'ox'
907
903
 
908
- # For Oga
909
- gem install oga
910
- # or add to Gemfile: gem 'oga'
911
-
912
904
  # Nokogiri usually already installed
913
905
  gem install nokogiri
914
906
  ----
@@ -53,7 +53,7 @@ A migration guide from Shale to Lutaml::Model is provided at link:../migrations/
53
53
  |
54
54
 
55
55
  | Adapter support
56
- | XML (Nokogiri, Ox, Oga), YAML, JSON (JSON, MultiJson), TOML (Toml-rb, Tomlib)
56
+ | XML (Nokogiri, Ox), YAML, JSON (JSON, MultiJson), TOML (Toml-rb, Tomlib)
57
57
  | XML (Nokogiri, Ox), YAML, JSON (JSON, MultiJson), TOML (Toml-rb, Tomlib), CSV
58
58
  | Lutaml::Model does not support CSV.
59
59
 
@@ -22,7 +22,7 @@ The auto-detection order for each format:
22
22
  [cols="1,2",options="header"]
23
23
  |===
24
24
  | Format | Detection order
25
- | XML | `:nokogiri` → `:ox` → `:oga` → `:rexml`
25
+ | XML | `:nokogiri` → `:ox` → `:rexml`
26
26
  | TOML | `:teptris` → `:tomlib` → `:toml_rb` (Windows: `:teptris` → `:toml_rb`)
27
27
  | JSON | `:standard` (always available)
28
28
  | YAML | `:standard` (always available)
@@ -70,11 +70,8 @@ When an adapter is needed for a format, `AdapterResolver` follows this chain:
70
70
  | `:ox`
71
71
  | Fastest performance. Native C extensions.
72
72
 
73
- | `:oga`
74
- | Pure Ruby. No compilation needed. Opal-compatible.
75
-
76
73
  | `:rexml`
77
- | Pure Ruby. Bundled with Ruby (default gem). Opal-compatible.
74
+ | Pure Ruby. Bundled with Ruby (default gem).
78
75
  |===
79
76
 
80
77
  === JSON adapters
@@ -167,7 +164,7 @@ TIP: `with_adapter` is thread-safe — each thread has its own scope stack. Use
167
164
  # Instead of this:
168
165
  around do |example|
169
166
  old = Config.xml_adapter
170
- Config.xml_adapter_type = :oga
167
+ Config.xml_adapter_type = :ox
171
168
  example.run
172
169
  ensure
173
170
  Config.xml_adapter = old
@@ -175,7 +172,7 @@ end
175
172
 
176
173
  # Prefer this:
177
174
  around do |example|
178
- Config.with_adapter(xml: :oga) { example.run }
175
+ Config.with_adapter(xml: :ox) { example.run }
179
176
  end
180
177
  ----
181
178
 
@@ -225,7 +222,7 @@ end
225
222
 
226
223
  If not explicitly configured, Lutaml::Model auto-detects on first use:
227
224
 
228
- * XML: `:nokogiri` if available, else `:ox` → `:oga` → `:rexml`
225
+ * XML: `:nokogiri` if available, else `:ox` → `:rexml`
229
226
  * JSON: `:standard` (alias: `:standard_json`)
230
227
  * YAML: `:standard` (alias: `:standard_yaml`)
231
228
  * Hash: `:standard` (alias: `:standard_hash`)
@@ -264,8 +261,7 @@ end
264
261
 
265
262
  * **Nokogiri**: Most projects (default, best compatibility)
266
263
  * **Ox**: Performance-critical applications
267
- * **Oga**: Pure Ruby environments
268
- * **REXML**: No extra gems, pure Ruby (bundled with Ruby). Also used under Opal.
264
+ * **REXML**: No extra gems, pure Ruby (bundled with Ruby).
269
265
 
270
266
  === Choose JSON adapter based on
271
267
 
@@ -279,36 +275,6 @@ end
279
275
  * **Tomlib**: Non-Windows projects without teptris (better performance)
280
276
  * **TomlRb**: Windows platforms without teptris (required due to tomlib incompatibility)
281
277
 
282
- == Opal runtime compatibility
283
-
284
- Lutaml::Model supports running under https://opalrb.com[Opal] (Ruby compiled to JavaScript) with some limitations. The library detects the runtime automatically via `Lutaml::Model::RuntimeCompatibility` and adapts its behavior accordingly.
285
-
286
- The XML parsing layer is provided by the https://github.com/lutaml/moxml[moxml] gem, which has been updated to support Opal. Under Opal, moxml uses the REXML adapter because Opal reimplements `strscan` and `stringio` in its stdlib, enabling REXML (pure Ruby) to compile cleanly to JavaScript.
287
-
288
- === Adapter defaults on Opal
289
-
290
- [cols="1,2",options="header"]
291
- |===
292
- | Format | Behavior
293
- | XML | Only `:rexml` is available (auto-selected). Opal reimplements strscan/stringio in its stdlib, enabling REXML to compile to JavaScript.
294
- | JSON | Only `:standard` is available. Oj and MultiJson require native extensions.
295
- | YAML | `:standard` (Psych ships with Opal's stdlib).
296
- | TOML | **Not available.** Both tomlib and toml-rb depend on native extensions.
297
- | Hash | `:standard` (pure Ruby).
298
- |===
299
-
300
- === Features unavailable on Opal
301
-
302
- The following features raise `NotImplementedError` when called under Opal:
303
-
304
- * `Lutaml::Model::Schema.to_xsd` -- XSD schema generation requires Nokogiri
305
- * `Lutaml::Model::Schema.to_relaxng` -- RELAX NG generation requires Nokogiri
306
- * `Lutaml::Model::Schema.from_xml` -- XML schema compilation is not supported
307
- * `Lutaml::Xml::Schema::Xsd::Base#to_formatted_xml` -- XSD formatted output requires the Canon gem
308
- * XPath queries -- REXML XPath requires features not yet supported by Opal's stdlib
309
-
310
- See the link:../guides/opal[Opal Usage Guide] for complete setup instructions and limitations.
311
-
312
278
  == See also
313
279
 
314
280
  * link:../serialization_adapters[Serialization Adapters Reference]
@@ -22,7 +22,6 @@ Fundamental concepts, configuration, and essential features of Lutaml::Model.
22
22
  * link:breaking-changes[Breaking Changes] - Version compatibility
23
23
  * link:comparison-with-shale[Comparison with Shale] - Migration guide
24
24
  * link:xml-conformance[XML Standards Conformance] - W3C spec compliance status
25
- * link:../guides/opal[Opal Usage] - Run in the browser via Opal
26
25
  * link:troubleshooting[Troubleshooting] - Common issues and solutions
27
26
 
28
27
  == Getting started
@@ -47,7 +47,7 @@ more information.
47
47
 
48
48
  Adapters are resolved lazily on first use. If no adapter is explicitly configured, `AdapterResolver` probes for available gems in a preferred order:
49
49
 
50
- * **XML**: `:nokogiri` → `:ox` → `:oga` → `:rexml`
50
+ * **XML**: `:nokogiri` → `:ox` → `:rexml`
51
51
  * **TOML**: `:teptris` → `:tomlib` → `:toml_rb` (Windows: `:teptris` → `:toml_rb`)
52
52
  * **JSON/YAML/Hash**: `:standard` (always available)
53
53
 
@@ -103,7 +103,7 @@ Syntax:
103
103
  require 'lutaml/model'
104
104
 
105
105
  Lutaml::Model::Config.configure do |config|
106
- config.xml_adapter = :nokogiri # can be one of [:nokogiri, :ox, :oga, :rexml]
106
+ config.xml_adapter = :nokogiri # can be one of [:nokogiri, :ox, :rexml]
107
107
  config.hash_adapter = :standard
108
108
  config.yaml_adapter = :standard
109
109
  config.json_adapter = :standard # can be one of [:standard, :multi_json, :oj]
@@ -189,18 +189,10 @@ Popular `libxml` based XML parser for Ruby.
189
189
  Requires native extensions (i.e. compiled C code).
190
190
  Requires the `nokogiri` gem.
191
191
 
192
- Oga::
193
- (optional, *deprecated*)
194
- Pure Ruby XML parser.
195
- Does not require native extensions.
196
- Requires the `oga` gem.
197
-
198
192
  [NOTE]
199
193
  ====
200
- The Oga engine is deprecated: moxml's default engine (Nokogiri, or the
201
- leptris native engine when present) is the supported XML lane.
202
- Selecting Oga emits a deprecation warning; removal is planned for a
203
- future release.
194
+ The Oga engine has been removed: `:oga` is no longer a selectable XML
195
+ engine. REXML is the pure-Ruby engine (deprecated).
204
196
  ====
205
197
 
206
198
  Ox::
@@ -213,8 +205,6 @@ REXML::
213
205
  (optional, *deprecated*)
214
206
  Pure Ruby XML parser, bundled as a default gem with Ruby.
215
207
  Moved from standard library to a default gem in Ruby 3.0.
216
- Opal-compatible: Opal reimplements `strscan` and `stringio` in its stdlib,
217
- enabling REXML to compile cleanly to JavaScript.
218
208
  Requires the `rexml` gem (bundled with Ruby by default).
219
209
 
220
210
  [NOTE]
@@ -234,8 +224,6 @@ require 'lutaml/model'
234
224
  Lutaml::Model::Config.configure do |config|
235
225
  config.xml_adapter = :nokogiri
236
226
  # or
237
- config.xml_adapter = :oga
238
- # or
239
227
  config.xml_adapter = :ox
240
228
  # or
241
229
  config.xml_adapter = :rexml
@@ -68,7 +68,7 @@ lib/lutaml/model/
68
68
 
69
69
  * Pluggable serialization libraries without changing model code
70
70
  * `SerializationAdapter` base class
71
- * Format-specific adapters: Nokogiri, Ox, Oga for XML; JSON, MultiJson, Oj for JSON
71
+ * Format-specific adapters: Nokogiri, Ox for XML; JSON, MultiJson, Oj for JSON
72
72
 
73
73
  === Strategy pattern
74
74
 
@@ -105,7 +105,7 @@ If this still feels confusing, think of it like organizing a party: Discovery fi
105
105
 
106
106
  This integration ensures the plan "annotates" the data tree without embedding logic in it, aligning with the "dumb adapters" goal—adapters just apply the plan to the data.
107
107
 
108
- 2. Adapters (e.g., Nokogiri, Oga, Ox) should traverse the `XmlDataModel` and `DeclarationPlan` trees in parallel (recursively, top-down from root), matching nodes by structure/position rather than lookup. This avoids runtime searches and ensures efficiency:
108
+ 2. Adapters (e.g., Nokogiri, Ox) should traverse the `XmlDataModel` and `DeclarationPlan` trees in parallel (recursively, top-down from root), matching nodes by structure/position rather than lookup. This avoids runtime searches and ensures efficiency:
109
109
 
110
110
  - **For Elements**: Start with `XmlElement` (data) and corresponding `DeclarationPlan::ElementNode` (plan).
111
111
  - Create the XML element using `XmlElement#qualified_name(plan.use_prefix)` (applies prefix if set).
@@ -146,9 +146,12 @@ Each row is the compiled form of one mapping rule:
146
146
  |===
147
147
 
148
148
  The in-memory precedent for this tuple is the shipped row shape
149
- `[rule, attr, kind, type, child_rows, child_register]`; the wire form
150
- replaces the Ruby object references (rule, attr, type, class) with
151
- portable identifiers.
149
+ `[rule, attr, kind, type, child_rows, child_register, discriminator,
150
+ absent_action]`. The seventh slot is the child's class-level
151
+ discriminator rule (`polymorphic_map:`) for `model` rows, resolved per
152
+ document; the eighth is the compiled absent-key action (<<absent>>).
153
+ The wire form replaces the Ruby object references (rule, attr, type,
154
+ class) with portable identifiers.
152
155
 
153
156
  The plan graph is a graph, not a tree. A recursive model graph — a tree
154
157
  whose nodes reference their own type, directly or through other model
@@ -187,14 +190,32 @@ shapes that are not ops-expressible — are **refusal gates**
187
190
  `type.cast(v)` is equivalent to `cast_value` — this equivalence is
188
191
  what made the plan gates the correct cast-precondition set.
189
192
 
193
+ [[absent]]
190
194
  === Absent keys and defaults
191
195
 
192
196
  Present-key detection uses the absent-vs-nil distinction the compiled
193
197
  walk makes (`fetch` with a sentinel; present-nil values read as nil).
194
- Absent rows carry the rule forward for default application.
195
- Resolution (<<open>>): the absent set returns to Ruby for the
196
- interpretive default path first; engine-side default application
197
- lands as a coverage card carrying defaults in the plan.
198
+ Each row carries a compiled **absent action**, decided at plan compile
199
+ from the attribute definition (#1311):
200
+
201
+ - `set`: assign the attribute's default through its writer — nil when
202
+ it has none — exactly as the walk's absent path does. Scalar rows and
203
+ model rows without a default take this action; the implicit
204
+ empty-collection default (`lazy_collection_default?`) does too,
205
+ because its value is provably the collection itself, so the writer
206
+ receives the same argument either way.
207
+ - `skip`: do nothing. A child-map rule with no default owns this
208
+ action: the walk returns before assigning, leaving the constructor
209
+ seed in place.
210
+ - `walk`: route the row through the interpretive absent path. Explicit
211
+ defaults on model-valued and child-map rules take it, because whether
212
+ a proc default materializes a document the rule must translate is not
213
+ a per-class constant. Runtime value-map overrides (`nil:`, `empty:`,
214
+ `omitted:`) also force it for every absent row of the node.
215
+
216
+ The plan therefore carries the absent outcome for the proven shapes
217
+ natively; the interpretive path remains the correctness reference for
218
+ `walk` rows.
198
219
 
199
220
  === Emission (Ruby → engine)
200
221
 
@@ -226,9 +247,14 @@ construction, so hydration depth is bound by the heap and never by the
226
247
  VM stack (#1297). Children complete before the parent instance is
227
248
  constructed; siblings hydrate in row order and collection items in
228
249
  document order; each child is linked to its parent, and to its root
229
- when it has none, once the parent instance exists. A child shape the
230
- plan does not cover unwinds the whole build to the fallback, which owns
231
- that shape's semantics and errors.
250
+ when it has none, once the parent instance exists. The frame's instance
251
+ is allocated through the compiled walk seed (`init_walk_state`); a
252
+ class with its own `initialize` runs that constructor body against the
253
+ seed with the generic attribute walk stood down (the #1059 contract),
254
+ so constructor-internal state and the generated defaults are identical
255
+ to the fallback's. A child shape the plan does not cover unwinds the
256
+ whole build to the fallback, which owns that shape's semantics and
257
+ errors.
232
258
 
233
259
  Parse errors: the engine raises the strict-parse contract (the
234
260
  `strict:` kwarg lineage — malformed input is a format error, never a
@@ -300,14 +326,15 @@ the gates table as the ledger.
300
326
  [[open]]
301
327
  == Resolutions (decided, with rationale)
302
328
 
303
- 1. *Defaults placement*: Ruby-side absent-row handling first
304
- (defaults apply through the interpretive absent path exactly as
305
- `kv_group_build` does today); engine-side default application
306
- lands as a coverage card carrying defaults in the plan.
307
- Rationale: the fallback is the correctness reference — shipping
308
- hydration before default relocation keeps the engine the strict
309
- subset; the measured win (the 61%) is in present-key casting,
310
- which this sequencing captures in full.
329
+ 1. *Defaults placement*: the absent action ships compiled per row
330
+ (#1311) — `set` rows assign the default through the writer, `skip`
331
+ rows leave the constructor seed, `walk` rows keep the interpretive
332
+ absent path. Rationale: the fallback remains the correctness
333
+ reference for the shapes whose outcome is not a per-class constant,
334
+ while the common shapes no longer pay a full rule-pipeline walk per
335
+ absent key — on the 3MB expressir wire those walks were ~three
336
+ quarters of the lane's samples. Engine-side default application
337
+ consumes the same per-row action rather than re-deriving it.
311
338
  2. *Custom type bindings*: accepted. Custom `Type::Value` subclasses
312
339
  ride the `Materialization` `type_bindings` pattern at plan level;
313
340
  unbound subclasses refuse to the fallback. Rationale: refusing