lutaml-model 0.8.200 → 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 (146) 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/attribute.rb +14 -2
  42. data/lib/lutaml/model/cached_type_resolver.rb +1 -7
  43. data/lib/lutaml/model/error/unknown_adapter_type_error.rb +1 -1
  44. data/lib/lutaml/model/global_context.rb +3 -5
  45. data/lib/lutaml/model/instrumentation.rb +0 -3
  46. data/lib/lutaml/model/mapping/mapping_rule.rb +6 -10
  47. data/lib/lutaml/model/register.rb +20 -31
  48. data/lib/lutaml/model/runtime_compatibility.rb +0 -92
  49. data/lib/lutaml/model/schema/class_loader.rb +2 -4
  50. data/lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb +2 -3
  51. data/lib/lutaml/model/serialize/attribute_definition.rb +10 -184
  52. data/lib/lutaml/model/serialize/conversion_caching.rb +1 -5
  53. data/lib/lutaml/model/serialize/model_import.rb +0 -5
  54. data/lib/lutaml/model/serialize/value_mapping.rb +0 -3
  55. data/lib/lutaml/model/services/rule_value_extractor.rb +4 -7
  56. data/lib/lutaml/model/store.rb +10 -17
  57. data/lib/lutaml/model/toml.rb +0 -2
  58. data/lib/lutaml/model/transformation_registry.rb +3 -7
  59. data/lib/lutaml/model/version.rb +1 -1
  60. data/lib/lutaml/model.rb +3 -19
  61. data/lib/lutaml/toml/format.rb +4 -8
  62. data/lib/lutaml/xml/adapter/moxml_adapter.rb +1 -7
  63. data/lib/lutaml/xml/adapter.rb +0 -4
  64. data/lib/lutaml/xml/adapter_loader.rb +1 -6
  65. data/lib/lutaml/xml/builder/base.rb +0 -3
  66. data/lib/lutaml/xml/builder.rb +0 -8
  67. data/lib/lutaml/xml/data_model.rb +1 -1
  68. data/lib/lutaml/xml/doctype_extractor.rb +3 -3
  69. data/lib/lutaml/xml/format.rb +22 -74
  70. data/lib/lutaml/xml/leptris/plan_compiler.rb +1 -2
  71. data/lib/lutaml/xml/model_transform.rb +14 -24
  72. data/lib/lutaml/xml/polymorphic_value_handler.rb +1 -1
  73. data/lib/lutaml/xml/schema/builder/moxml.rb +1 -1
  74. data/lib/lutaml/xml/schema/builder.rb +6 -9
  75. data/lib/lutaml/xml/schema/relaxng_schema.rb +1 -1
  76. data/lib/lutaml/xml/xml_element.rb +3 -2
  77. data/lib/lutaml/xml/xsd_validator.rb +4 -11
  78. data/lib/lutaml/yaml/adapter/yeptris_adapter.rb +2 -2
  79. data/lib/lutaml/yamls/adapter_loader.rb +1 -5
  80. data/lib/tasks/performance_comparator.rb +1 -1
  81. data/lutaml-model.gemspec +3 -8
  82. data/spec/benchmarks/xml_parsing_benchmark_spec.rb +1 -1
  83. data/spec/lutaml/json/adapter/standard_adapter_spec.rb +6 -9
  84. data/spec/lutaml/model/adapter_resolver_yeptris_switch_spec.rb +0 -2
  85. data/spec/lutaml/model/cached_type_resolver_spec.rb +2 -54
  86. data/spec/lutaml/model/cdata_spec.rb +2 -15
  87. data/spec/lutaml/model/encoding_spec.rb +0 -9
  88. data/spec/lutaml/model/except_spec.rb +0 -7
  89. data/spec/lutaml/model/json_spec.rb +0 -14
  90. data/spec/lutaml/model/mixed_content_spec.rb +6 -46
  91. data/spec/lutaml/model/ordered_content_spec.rb +0 -7
  92. data/spec/lutaml/model/polymorphic_scalar_member_spec.rb +57 -0
  93. data/spec/lutaml/model/processing_instruction_spec.rb +0 -6
  94. data/spec/lutaml/model/runtime_compatibility_spec.rb +0 -37
  95. data/spec/lutaml/model/serializable_spec.rb +0 -2
  96. data/spec/lutaml/model/toml_spec.rb +0 -23
  97. data/spec/lutaml/xml/adapter/base_adapter_regression_spec.rb +0 -4
  98. data/spec/lutaml/xml/adapter/order_spec.rb +1 -1
  99. data/spec/lutaml/xml/adapter/xml_namespace_spec.rb +0 -7
  100. data/spec/lutaml/xml/attribute_namespace_disjointness_spec.rb +6 -6
  101. data/spec/lutaml/xml/builder/builder_spec.rb +0 -24
  102. data/spec/lutaml/xml/default_namespace_spec.rb +1 -8
  103. data/spec/lutaml/xml/doctype_preservation_spec.rb +0 -4
  104. data/spec/lutaml/xml/entity_fragmentation_spec.rb +0 -6
  105. data/spec/lutaml/xml/fpi_namespace_spec.rb +0 -21
  106. data/spec/lutaml/xml/mapping_spec.rb +8 -15
  107. data/spec/lutaml/xml/namespace_scope_vcard_spec.rb +0 -7
  108. data/spec/lutaml/xml/namespace_spec.rb +0 -13
  109. data/spec/lutaml/xml/prefix_control_spec.rb +0 -6
  110. data/spec/lutaml/xml/schema/builder_moxml_spec.rb +1 -1
  111. data/spec/lutaml/xml/xml_adapter_spec.rb +0 -7
  112. data/spec/lutaml/xml/xml_spec.rb +2 -88
  113. data/spec/spec_helper.rb +5 -24
  114. data/spec/support/test_adapter_config.rb +6 -6
  115. metadata +1 -32
  116. data/.github/workflows/js-pr-check.yml +0 -106
  117. data/.github/workflows/js-sync.yml +0 -55
  118. data/.github/workflows/opal.yml +0 -65
  119. data/.gitmodules +0 -6
  120. data/.rspec-opal +0 -5
  121. data/docs/_guides/opal.adoc +0 -232
  122. data/lib/compat/opal/generate_boot.rb +0 -137
  123. data/lib/compat/opal/js_bundle_entry.rb +0 -42
  124. data/lib/compat/opal/lutaml_model_boot.rb +0 -638
  125. data/lib/compat/opal/monitor.rb +0 -31
  126. data/lib/compat/opal/moxml/adapter/customized_rexml/entity_reference.rb +0 -9
  127. data/lib/compat/opal/moxml/adapter/customized_rexml/formatter.rb +0 -225
  128. data/lib/compat/opal/moxml/adapter/customized_rexml.rb +0 -11
  129. data/lib/compat/opal/moxml_boot.rb +0 -68
  130. data/lib/compat/opal/objectspace_shim.rb +0 -23
  131. data/lib/compat/opal/rexml/namespace.rb +0 -59
  132. data/lib/compat/opal/rexml/parsers/baseparser.rb +0 -1016
  133. data/lib/compat/opal/rexml/source.rb +0 -214
  134. data/lib/compat/opal/rexml/text.rb +0 -426
  135. data/lib/compat/opal/rexml/xmltokens.rb +0 -45
  136. data/lib/compat/opal/rexml_compat.rb +0 -85
  137. data/lib/compat/opal/yaml_compat.rb +0 -32
  138. data/lib/lutaml/model/cached_type_resolver/mutex_hash_cache.rb +0 -53
  139. data/lib/lutaml/model/schema/schema_builder/oga.rb +0 -92
  140. data/lib/lutaml/xml/schema/builder/oga.rb +0 -92
  141. data/spec/lutaml/model/boot_manifest_spec.rb +0 -30
  142. data/spec/lutaml/model/opal_smoke_spec.rb +0 -199
  143. data/spec/lutaml/model/serialize/attribute_definition_block_form_spec.rb +0 -244
  144. data/spec/lutaml/xml/adapter/oga_adapter_spec.rb +0 -135
  145. data/spec/lutaml/xml/opal_xml_spec.rb +0 -204
  146. data/spec/support/opal.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a7958849b1b037485644838e6cd7b3264546a8f25fdfd8d29d694595fb2c4be
4
- data.tar.gz: 16e38f14e5d3c06b55073d626dcf79e8fb93f33c1775bf2ef2288d62d614c617
3
+ metadata.gz: 40f311f7fc21d88ef8df8d86e76da0fc15ef1fcbf53c1553d295e9edfcb068a9
4
+ data.tar.gz: 853924b3e3c3c486fc36076b4272124eb9571a1d9ecd128ae000e86768c2b9d9
5
5
  SHA512:
6
- metadata.gz: 290f49e6e4d3801291845ffd8ef58822363f70fdc8a8ee17013757a5a5afc3b10ff73187bf75a8e11a20271750534f3e6c0b888569dc1f81f71db12e36d906b9
7
- data.tar.gz: 2df50e5220736a2d7468cd5ae6713e819cce37bfcfaacf7c7248901db6f31023d01a92015f7dd1bbb02db1876f66b9def21ea2309de15414f777d714227aeb15
6
+ metadata.gz: 2037c368c6cb876b065c63648cca792c8eeaee64b71fce7345124a5096c9f6996d14f91ddc76c7e4369d7ab68433c53af98bca6c719f3946e5f67e07dd711a53
7
+ data.tar.gz: 415d00ae9c95ee6c7a429f40174f1cfb29a84b0878f77a1bd1bfb0a83bdfd6bc61c23713a3294c8dcf4158410e19074953c99955ea1f77943de3a08fe05ae581
@@ -3,8 +3,7 @@
3
3
  # Smoke test for the INSTALLED lutaml-model gem (parsanol-ruby
4
4
  # pattern, lutaml-model#833): runs against the gem's own load paths —
5
5
  # never the repo — and exercises the boot surface a packaging
6
- # regression would break: every format round-trip and the Opal boot
7
- # manifest's autoload coverage.
6
+ # regression would break: every format round-trip.
8
7
 
9
8
  gem_root = Gem::Specification.find_by_name("lutaml-model").full_gem_path
10
9
  raise "installed lutaml-model not found" unless gem_root
@@ -12,17 +11,6 @@ raise "installed lutaml-model not found" unless gem_root
12
11
  $LOAD_PATH.unshift(File.join(gem_root, "lib"))
13
12
  require "lutaml/model"
14
13
 
15
- # Boot manifest: every autoload in lib/compat/opal/lutaml_model_boot.rb
16
- # must resolve from the installed gem alone.
17
- boot = File.join(gem_root, "lib", "compat", "opal", "lutaml_model_boot.rb")
18
- if File.exist?(boot)
19
- manifest = File.read(boot)
20
- missing = manifest.scan(/autoload[^\n]*["']([^"']+)["']/).flatten.select do |path|
21
- !File.exist?(File.join(gem_root, "lib", path))
22
- end
23
- raise "boot manifest references missing files: #{missing.inspect}" unless missing.empty?
24
- end
25
-
26
14
  class Smoke < Lutaml::Model::Serializable
27
15
  attribute :name, :string
28
16
  attribute :count, :integer
@@ -49,12 +49,9 @@ jobs:
49
49
  - uses: actions/checkout@v6
50
50
  with:
51
51
  fetch-depth: 0
52
- submodules: "recursive"
53
52
 
54
53
  - name: Create main worktree for baseline
55
- run: |
56
- git worktree add /tmp/main-checkout origin/main
57
- (cd /tmp/main-checkout && git submodule update --init --recursive)
54
+ run: git worktree add /tmp/main-checkout origin/main
58
55
 
59
56
  - name: Set up Ruby
60
57
  uses: ruby/setup-ruby@v1
@@ -62,30 +59,12 @@ jobs:
62
59
  ruby-version: '3.4'
63
60
  bundler-cache: false
64
61
 
65
- - name: Install ragel
66
- run: sudo apt-get update && sudo apt-get install -y ragel
67
-
68
- - name: Install ruby-ll (for rake vendor:prepare)
69
- run: gem install ruby-ll --no-document
70
-
71
- - name: Generate ragel / ruby-ll outputs in vendored forks (current)
72
- run: rake vendor:prepare
73
-
74
- - name: Generate ragel / ruby-ll outputs in vendored forks (main baseline)
75
- run: (cd /tmp/main-checkout && rake vendor:prepare)
76
-
77
62
  - name: Configure bundler
78
63
  run: |
79
64
  mkdir -p .bundle
80
65
  echo "---" > .bundle/config
81
66
  echo 'BUNDLE_BUILD__RUBY___LL: "--with-cflags=-std=gnu17"' >> .bundle/config
82
67
 
83
- - name: Compile liboga / libll native extensions (current)
84
- run: rake vendor:compile
85
-
86
- - name: Compile liboga / libll native extensions (main baseline)
87
- run: (cd /tmp/main-checkout && rake vendor:compile)
88
-
89
68
  - name: Checkout downstream (${{ matrix.repo }})
90
69
  uses: actions/checkout@v6
91
70
  with:
@@ -19,29 +19,14 @@ jobs:
19
19
  timeout-minutes: 30
20
20
  steps:
21
21
  - uses: actions/checkout@v6
22
- with:
23
- submodules: "recursive"
24
22
 
25
23
  - name: Set up Ruby
26
24
  uses: ruby/setup-ruby@v1
27
25
  with:
28
26
  ruby-version: '3.4'
29
- # bundler-cache disabled: must run rake vendor:prepare before
30
- # bundle install can compile the path-source forks' C extensions.
27
+ # bundler-cache disabled: adapter pins resolve per run.
31
28
  bundler-cache: false
32
29
 
33
- - name: Install ragel
34
- run: sudo apt-get update && sudo apt-get install -y ragel
35
-
36
- - name: Install ruby-ll (for rake vendor:prepare)
37
- run: gem install ruby-ll --no-document
38
-
39
- - name: Generate ragel / ruby-ll outputs in vendored forks
40
- # Path-source oga and ruby-ll forks gitignore their generated
41
- # parser/lexer outputs. bundle install compiles the C extensions
42
- # via each fork's extconf.rb, which needs ext/c/lexer.c to exist.
43
- run: rake vendor:prepare
44
-
45
30
  - name: Configure bundler
46
31
  run: |
47
32
  mkdir -p .bundle
@@ -51,9 +36,6 @@ jobs:
51
36
  - name: Install dependencies
52
37
  run: bundle install
53
38
 
54
- - name: Compile liboga / libll native extensions
55
- run: rake vendor:compile
56
-
57
39
  - name: Run performance benchmarks
58
40
  run: bundle exec rake performance:compare
59
41
  # TODO.max-perf/36: YJIT moves exactly the interpretive paths the
@@ -65,8 +47,6 @@ jobs:
65
47
  timeout-minutes: 15
66
48
  steps:
67
49
  - uses: actions/checkout@v6
68
- with:
69
- submodules: "recursive"
70
50
 
71
51
  - name: Set up Ruby
72
52
  uses: ruby/setup-ruby@v1
@@ -74,15 +54,6 @@ jobs:
74
54
  ruby-version: '3.4'
75
55
  bundler-cache: false
76
56
 
77
- - name: Install ragel
78
- run: sudo apt-get update && sudo apt-get install -y ragel
79
-
80
- - name: Install ruby-ll (for rake vendor:prepare)
81
- run: gem install ruby-ll --no-document
82
-
83
- - name: Generate ragel / ruby-ll outputs in vendored forks
84
- run: rake vendor:prepare
85
-
86
57
  - name: Configure bundler
87
58
  run: |
88
59
  mkdir -p .bundle
@@ -92,9 +63,6 @@ jobs:
92
63
  - name: Install dependencies
93
64
  run: bundle install
94
65
 
95
- - name: Compile liboga / libll native extensions
96
- run: rake vendor:compile
97
-
98
66
  - name: Probe YJIT off
99
67
  run: bundle exec rake performance:probe
100
68
 
@@ -23,17 +23,13 @@ jobs:
23
23
  os: [ubuntu-latest, macos-latest, windows-latest]
24
24
  ruby: ["3.3", "3.4", "4.0"]
25
25
  experimental: [false]
26
- # ruby head runs on ubuntu/macos only: windows-head cannot build
27
- # the released ruby-ll C extension (and the vendored forks exist
28
- # for Opal), so that cell was permanently red with zero signal
29
- # (#832 follow-up).
26
+ # ruby head runs on ubuntu/macos only: the windows-head cell was
27
+ # permanently red with zero signal (#832 follow-up).
30
28
  exclude:
31
29
  - os: windows-latest
32
30
  ruby: head
33
31
  steps:
34
32
  - uses: actions/checkout@v6
35
- with:
36
- submodules: "recursive"
37
33
 
38
34
  - name: Set up Ruby
39
35
  uses: ruby/setup-ruby@v1
data/.rubocop.yml CHANGED
@@ -17,16 +17,6 @@ AllCops:
17
17
  - '**/*.md'
18
18
  - 'niso-jats/**/*'
19
19
  - 'sts-ruby/**/*'
20
- # Vendored from lutaml/moxml 0.5.167's lib/compat/opal (the rexml
21
- # Opal shadows moxml 0.6 no longer ships); upstream style, kept
22
- # byte-identical so diffs against the source stay meaningful.
23
- - 'lib/compat/opal/rexml/**/*'
24
- - 'lib/compat/opal/rexml_compat.rb'
25
- - 'lib/compat/opal/moxml/**/*'
26
- # Opal stdlib shims keep stdlib spellings and pass-through
27
- # semantics; style cops do not apply.
28
- - 'lib/compat/opal/monitor.rb'
29
- - 'lib/compat/opal/objectspace_shim.rb'
30
20
 
31
21
  Style/OneClassPerFile:
32
22
  inherit_mode:
data/.rubocop_todo.yml CHANGED
@@ -37,7 +37,6 @@ Layout/AssignmentIndentation:
37
37
  # SupportedStylesAlignWith: either, start_of_block, start_of_line
38
38
  Layout/BlockAlignment:
39
39
  Exclude:
40
- - 'lib/compat/opal/generate_boot.rb'
41
40
  - 'lib/lutaml/model/schema/file_writer.rb'
42
41
  - 'lib/lutaml/model/schema/renderers/mappings.rb'
43
42
  - 'lib/lutaml/model/schema/renderers/member_decls.rb'
@@ -54,7 +53,6 @@ Layout/BlockAlignment:
54
53
  # This cop supports safe autocorrection (--autocorrect).
55
54
  Layout/BlockEndNewline:
56
55
  Exclude:
57
- - 'lib/compat/opal/generate_boot.rb'
58
56
  - 'lib/lutaml/model/schema/file_writer.rb'
59
57
  - 'lib/lutaml/model/schema/renderers/mappings.rb'
60
58
  - 'lib/lutaml/model/schema/renderers/member_decls.rb'
@@ -104,7 +102,6 @@ Layout/HashAlignment:
104
102
  # SupportedStylesAlignWith: start_of_line, relative_to_receiver
105
103
  Layout/IndentationWidth:
106
104
  Exclude:
107
- - 'lib/compat/opal/generate_boot.rb'
108
105
  - 'lib/lutaml/model/schema/file_writer.rb'
109
106
  - 'lib/lutaml/model/schema/renderers/mappings.rb'
110
107
  - 'lib/lutaml/model/schema/renderers/member_decls.rb'
@@ -510,7 +507,6 @@ Security/MarshalLoad:
510
507
  # AllowedMethods: lambda, proc, it
511
508
  Style/BlockDelimiters:
512
509
  Exclude:
513
- - 'lib/compat/opal/generate_boot.rb'
514
510
  - 'lib/lutaml/model/schema/file_writer.rb'
515
511
  - 'lib/lutaml/model/schema/renderers/mappings.rb'
516
512
  - 'lib/lutaml/model/schema/renderers/member_decls.rb'
data/Gemfile CHANGED
@@ -5,23 +5,6 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in lutaml-model.gemspec
6
6
  gemspec
7
7
 
8
- # Opal-compatible forks of oga and ruby-ll. The forks add pure-Ruby lexer
9
- # and driver fallbacks (under ext/pureruby/) plus an Opal-aware conditional
10
- # in lib/oga.rb / lib/ll/setup.rb that selects the pure-Ruby implementation
11
- # when RUBY_PLATFORM == 'opal'. Under CRuby/JRuby the forks behave
12
- # identically to upstream (the conditional falls through to liboga/libll).
13
- # The vendored forks are Opal-compatibility shims (pure-Ruby lexer)
14
- # used by the Opal CI leg ONLY (LUTAML_OPAL_FORKS=1 in opal.yml) —
15
- # #835 step 2. Every MRI leg runs against released oga/ruby-ll; the
16
- # forks' C extension is upstream's and adds nothing under MRI.
17
- if ENV["LUTAML_OPAL_FORKS"]
18
- gem "oga", path: "vendor/opal-oga"
19
- gem "ruby-ll", path: "vendor/opal-ruby-ll"
20
- else
21
- gem "oga"
22
- gem "ruby-ll"
23
- end
24
-
25
8
  # needed for liquid with ruby 3.4
26
9
  gem "base64"
27
10
  gem "benchmark-ips"
@@ -70,9 +53,3 @@ gem "toml-rb"
70
53
  # ruby-prof works on all platforms including Windows (unlike stackprof)
71
54
  # Provides both CPU and memory profiling
72
55
  gem "ruby-prof", group: :development
73
-
74
- group :opal do
75
- gem "opal", "~> 1.8"
76
- gem "opal-rspec", "~> 1.0"
77
- gem "opal-sprockets"
78
- end
data/README.adoc CHANGED
@@ -313,41 +313,14 @@ gem install lutaml-model
313
313
 
314
314
  Lutaml::Model includes a command line interface (CLI) that provides useful tools for working with your data models. The CLI is available through the `lutaml-model` command after installation.
315
315
 
316
- == Opal (JavaScript) support
316
+ == JavaScript (npm) package
317
317
 
318
- Lutaml::Model runs under
319
- https://opalrb.com/[Opal] (Ruby compiled to JavaScript), which
320
- powers the
321
- https://www.npmjs.com/package/@lutaml/lutaml-model[`@lutaml/lutaml-model`]
322
- npm package. Two pure-Ruby XML adapters ship under Opal:
323
-
324
- * **Oga** (default) — compiled from the vendored `opal-oga` fork,
325
- which provides a pure-Ruby lexer.
326
- * **REXML** (opt-in) — compiled from the bundled stdlib gem, with
327
- moxml's `lib/compat/opal/rexml/*` shadows patching the parts Opal
328
- can't follow natively.
329
-
330
- Nokogiri and Ox are C extensions and are not available under Opal.
331
-
332
- [source,ruby]
333
- ----
334
- # Default (Oga)
335
- Lutaml::Model::Config.xml_adapter_type = :oga
336
-
337
- # Opt-in to REXML
338
- Lutaml::Model::Config.xml_adapter_type = :rexml
339
- ----
340
-
341
- The Opal smoke specs in `spec/lutaml/xml/opal_xml_spec.rb` run a
342
- shared XML round-trip contract against BOTH adapters so a regression
343
- in either is caught at CI time (`bundle exec rake spec:opal`).
344
-
345
- The npm package `@lutaml/lutaml-model` is rebuilt automatically by
346
- the `lutaml-model-js` repo on every push to this repo's `main` branch
347
- (publishes under the `next` dist-tag) and on every stable gem release
348
- (publishes under `latest`). See
349
- https://github.com/lutaml/lutaml-model-js[`lutaml-model-js`] for
350
- details.
318
+ The npm package `@lutaml/lutaml-model` was built by compiling this gem
319
+ with Opal. That compilation layer has been removed from this gem, so
320
+ the package is no longer rebuilt from this repository's `main` branch
321
+ or from gem releases. The cross-language realization of lutaml-model
322
+ declarations (https://github.com/lutaml/lutaml-model/issues/1033[issue
323
+ #1033]) is the successor for JavaScript consumers.
351
324
 
352
325
  === Compare Command
353
326
 
@@ -9960,9 +9933,6 @@ on the adapter used.
9960
9933
  ** Nokogiri: `UTF-8`. The encoding is set to the default encoding of the Nokogiri library,
9961
9934
  which is `UTF-8`.
9962
9935
 
9963
- ** Oga: `UTF-8`. The encoding is set to the default encoding of the Oga library, which
9964
- uses `UTF-8`.
9965
-
9966
9936
  ** Ox: `ASCII-8bit`. The encoding is set to the default encoding of the Ox library, which uses
9967
9937
  `ASCII-8bit`.
9968
9938
 
@@ -10607,7 +10577,7 @@ Both systems follow the same architectural pattern:
10607
10577
  | `KeyValue::Transformation`
10608
10578
 
10609
10579
  | Adapters
10610
- | Nokogiri, Ox, Oga
10580
+ | Nokogiri, Ox
10611
10581
  | StandardJson, MultiJson, Oj, StandardYaml, TomlRb, Tomlib
10612
10582
 
10613
10583
  | Compilation
@@ -13416,20 +13386,20 @@ NOTE: For `NokogiriAdapter`, we can also call `to_xml` on `value.node.adapter_no
13416
13386
  # @namespace_prefix=nil,
13417
13387
  # @text=nil>
13418
13388
 
13419
- # Oga Adapter Node
13389
+ # Adapter Node
13420
13390
 
13421
- # <Lutaml::Model::Xml::Oga::Element:0x0000000107314158
13391
+ # <Lutaml::Xml::AdapterElement:0x0000000107314158
13422
13392
  # @attributes={},
13423
13393
  # @children=
13424
- # [#<Lutaml::Model::Xml::Oga::Element:0x0000000107314090 @attributes={}, @children=[], @default_namespace=nil, @name="text", @namespace_prefix=nil, @text="\n ">,
13425
- # #<Lutaml::Model::Xml::Oga::Element:0x000000010730fe78
13394
+ # [#<Lutaml::Xml::AdapterElement:0x0000000107314090 @attributes={}, @children=[], @default_namespace=nil, @name="text", @namespace_prefix=nil, @text="\n ">,
13395
+ # #<Lutaml::Xml::AdapterElement:0x000000010730fe78
13426
13396
  # @attributes={},
13427
- # @children=[#<Lutaml::Model::Xml::Oga::Element:0x000000010730fd88 @attributes={}, @children=[], @default_namespace=nil, @name="text", @namespace_prefix=nil, @text="Metadata">],
13397
+ # @children=[#<Lutaml::Xml::AdapterElement:0x000000010730fd88 @attributes={}, @children=[], @default_namespace=nil, @name="text", @namespace_prefix=nil, @text="Metadata">],
13428
13398
  # @default_namespace=nil,
13429
13399
  # @name="category",
13430
13400
  # @namespace_prefix=nil,
13431
13401
  # @text="Metadata">,
13432
- # #<Lutaml::Model::Xml::Oga::Element:0x000000010730f8d8 @attributes={}, @children=[], @default_namespace=nil, @name="text", @namespace_prefix=nil, @text="\n ">],
13402
+ # #<Lutaml::Xml::AdapterElement:0x000000010730f8d8 @attributes={}, @children=[], @default_namespace=nil, @name="text", @namespace_prefix=nil, @text="\n ">],
13433
13403
  # @default_namespace=nil,
13434
13404
  # @name="metadata",
13435
13405
  # @namespace_prefix=nil,
@@ -16326,7 +16296,7 @@ There are two ways to specify a configuration:
16326
16296
 
16327
16297
  Adapters are auto-detected on first use. The defaults when gems are available:
16328
16298
 
16329
- * XML: `:nokogiri` (auto-detected: `:nokogiri` → `:ox` → `:oga` → `:rexml`)
16299
+ * XML: `:nokogiri` (auto-detected: `:nokogiri` → `:ox` → `:rexml`)
16330
16300
  * YAML: `:standard` (alias: `:standard_yaml`)
16331
16301
  * JSON: `:standard` (alias: `:standard_json`)
16332
16302
  * Hash: `:standard` (alias: `:standard_hash`)
@@ -16349,7 +16319,7 @@ Syntax:
16349
16319
  require 'lutaml/model'
16350
16320
 
16351
16321
  Lutaml::Model::Config.configure do |config|
16352
- config.xml_adapter_type = :nokogiri # can be one of [:nokogiri, :ox, :oga, :rexml]
16322
+ config.xml_adapter_type = :nokogiri # can be one of [:nokogiri, :ox, :rexml]
16353
16323
  config.hash_adapter = :standard
16354
16324
  config.yaml_adapter = :standard
16355
16325
  config.json_adapter = :standard # can be one of [:standard, :multi_json, :oj]
@@ -16400,12 +16370,11 @@ Popular `libxml` based XML parser for Ruby.
16400
16370
  Requires native extensions (i.e. compiled C code).
16401
16371
  Requires the `nokogiri` gem.
16402
16372
 
16403
- Oga::
16404
- (optional)
16405
- Pure Ruby XML parser.
16406
- Does not require native extensions and is suitable for
16407
- https://opalrb.com[Opal] (Ruby on JavaScript).
16408
- Requires the `oga` gem.
16373
+ [NOTE]
16374
+ ====
16375
+ The Oga engine has been removed: `:oga` is no longer a selectable XML
16376
+ engine. REXML is the pure-Ruby engine.
16377
+ ====
16409
16378
 
16410
16379
  Ox::
16411
16380
  (optional)
@@ -16428,8 +16397,6 @@ require 'lutaml/model'
16428
16397
  Lutaml::Model::Config.configure do |config|
16429
16398
  config.xml_adapter = :nokogiri
16430
16399
  # or
16431
- config.xml_adapter = :oga
16432
- # or
16433
16400
  config.xml_adapter = :ox
16434
16401
  # or
16435
16402
  config.xml_adapter = :rexml
@@ -16622,29 +16589,6 @@ my_model.to_xml # uses Ox (user's choice)
16622
16589
  ----
16623
16590
 
16624
16591
 
16625
- [[opal-compatibility]]
16626
- === Opal compatibility
16627
-
16628
- Lutaml::Model supports running under https://opalrb.com[Opal] (Ruby compiled to
16629
- JavaScript). The runtime is detected automatically and adapter selection is
16630
- adjusted accordingly.
16631
-
16632
- * *XML*: Only the `:rexml` adapter is available (auto-selected). Opal
16633
- reimplements `strscan` and `stringio` in its stdlib, enabling REXML (pure
16634
- Ruby) to compile cleanly to JavaScript.
16635
- * *JSON*: Only the `:standard` adapter is available.
16636
- * *YAML*: Only the `:standard` adapter is available.
16637
- * *TOML*: Not available on Opal.
16638
- * *Schema generation*: `to_xsd`, `to_relaxng`, and `from_xml` (XML schema
16639
- compilation) raise `NotImplementedError` on Opal.
16640
- * *Liquid templating*: Not available on Opal (Phase 1 — skipped).
16641
- * *XPath*: Not available on Opal (REXML XPath requires features not yet
16642
- supported by Opal's stdlib).
16643
-
16644
- See the link:docs/_guides/opal.adoc[Opal Usage Guide] for setup instructions
16645
- and limitations.
16646
-
16647
-
16648
16592
  === Error handling
16649
16593
 
16650
16594
  When parsing invalid serialization format data, an `InvalidFormatError` is
@@ -16808,14 +16752,9 @@ both element declaration and type definition
16808
16752
 
16809
16753
  === Adapter support
16810
16754
 
16811
- XSD generation uses SchemaBuilder adapters:
16812
-
16813
- * `Nokogiri`: Default,
16814
- full XSD 1.0 support
16815
- * `Oga`: Pure Ruby, feature
16816
- complete
16817
-
16818
- Both adapters produce identical, standards-compliant XSD output.
16755
+ XSD generation uses the SchemaBuilder adapters: the Nokogiri wrapper for
16756
+ byte-identical emission, and the moxml layer for every other configured
16757
+ engine. Both produce identical, standards-compliant XSD output.
16819
16758
 
16820
16759
  === Complete example
16821
16760
 
@@ -17964,7 +17903,7 @@ link:docs/migration-guides/0-1-0-migrate-from-shale.adoc[Migrating from Shale to
17964
17903
  |
17965
17904
 
17966
17905
  | Adapter support
17967
- | XML (Nokogiri, Ox, Oga, REXML), YAML, JSON (JSON, MultiJson), TOML (Toml-rb, Tomlib)
17906
+ | XML (Nokogiri, Ox, REXML), YAML, JSON (JSON, MultiJson), TOML (Toml-rb, Tomlib)
17968
17907
  | XML (Nokogiri, Ox), YAML, JSON (JSON, MultiJson), TOML (Toml-rb, Tomlib), CSV
17969
17908
  | Lutaml::Model does not support CSV.
17970
17909
 
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]