lutaml-model 0.8.16 → 0.8.18

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 (230) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/downstream-performance.yml +27 -1
  3. data/.github/workflows/js-pr-check.yml +102 -0
  4. data/.github/workflows/js-sync.yml +51 -0
  5. data/.github/workflows/opal.yml +26 -6
  6. data/.github/workflows/performance.yml +32 -7
  7. data/.github/workflows/rake.yml +78 -32
  8. data/.github/workflows/release.yml +0 -3
  9. data/.gitmodules +6 -0
  10. data/.rubocop_todo.yml +76 -12
  11. data/Gemfile +16 -1
  12. data/README.adoc +267 -0
  13. data/Rakefile +166 -4
  14. data/docs/_guides/schema-import.adoc +42 -0
  15. data/docs/_guides/xml/namespace-semantics.adoc +2 -0
  16. data/docs/_guides/xml-mapping.adoc +21 -0
  17. data/docs/_guides/xml-namespace-qualification.adoc +142 -0
  18. data/docs/_pages/validation.adoc +65 -0
  19. data/docs/_tutorials/xml-element-attribute-namespace-guide.adoc +2 -0
  20. data/docs/_tutorials/xml-schema-primer-style-guide.adoc +2 -0
  21. data/docs/namespace-management.adoc +2 -0
  22. data/docs/xml-schema-qualification.md +6 -0
  23. data/lib/compat/opal/generate_boot.rb +123 -0
  24. data/lib/compat/opal/js_bundle_entry.rb +42 -0
  25. data/lib/compat/opal/lutaml_model_boot.rb +497 -0
  26. data/lib/compat/opal/moxml_boot.rb +68 -0
  27. data/lib/compat/opal/yaml_compat.rb +32 -0
  28. data/lib/lutaml/json.rb +1 -1
  29. data/lib/lutaml/jsonld.rb +1 -4
  30. data/lib/lutaml/key_value/transform.rb +3 -8
  31. data/lib/lutaml/key_value/transformation/value_serializer.rb +14 -1
  32. data/lib/lutaml/key_value/transformation.rb +17 -5
  33. data/lib/lutaml/model/adapter_resolver.rb +2 -2
  34. data/lib/lutaml/model/attribute.rb +88 -11
  35. data/lib/lutaml/model/cached_type_resolver.rb +1 -1
  36. data/lib/lutaml/model/choice.rb +34 -0
  37. data/lib/lutaml/model/compiled_rule.rb +7 -0
  38. data/lib/lutaml/model/error/union_schema_unsupported_error.rb +11 -0
  39. data/lib/lutaml/model/global_context.rb +11 -8
  40. data/lib/lutaml/model/instrumentation.rb +2 -2
  41. data/lib/lutaml/model/mapping/mapping_rule.rb +0 -6
  42. data/lib/lutaml/model/register.rb +2 -2
  43. data/lib/lutaml/model/runtime_compatibility.rb +50 -0
  44. data/lib/lutaml/model/schema/class_loader.rb +58 -0
  45. data/lib/lutaml/model/schema/compiled_output.rb +83 -0
  46. data/lib/lutaml/model/schema/definitions/attribute.rb +32 -0
  47. data/lib/lutaml/model/schema/definitions/choice.rb +20 -0
  48. data/lib/lutaml/model/schema/definitions/facet.rb +40 -0
  49. data/lib/lutaml/model/schema/definitions/group_import.rb +22 -0
  50. data/lib/lutaml/model/schema/definitions/member_walk.rb +33 -0
  51. data/lib/lutaml/model/schema/definitions/model.rb +40 -0
  52. data/lib/lutaml/model/schema/definitions/namespace.rb +23 -0
  53. data/lib/lutaml/model/schema/definitions/restricted_type.rb +30 -0
  54. data/lib/lutaml/model/schema/definitions/sequence.rb +19 -0
  55. data/lib/lutaml/model/schema/definitions/simple_content.rb +22 -0
  56. data/lib/lutaml/model/schema/definitions/transform_facet.rb +21 -0
  57. data/lib/lutaml/model/schema/definitions/type_ref.rb +20 -0
  58. data/lib/lutaml/model/schema/definitions/union_type.rb +28 -0
  59. data/lib/lutaml/model/schema/definitions/xml_root.rb +20 -0
  60. data/lib/lutaml/model/schema/definitions.rb +24 -0
  61. data/lib/lutaml/model/schema/file_writer.rb +70 -0
  62. data/lib/lutaml/model/schema/generator/definitions_collection.rb +16 -2
  63. data/lib/lutaml/model/schema/generator/property.rb +21 -4
  64. data/lib/lutaml/model/schema/module_nesting.rb +31 -0
  65. data/lib/lutaml/model/schema/namespace_naming.rb +46 -0
  66. data/lib/lutaml/model/schema/registry_generator.rb +115 -0
  67. data/lib/lutaml/model/schema/renderers/base.rb +40 -0
  68. data/lib/lutaml/model/schema/renderers/mappings.rb +72 -0
  69. data/lib/lutaml/model/schema/renderers/member_decls.rb +115 -0
  70. data/lib/lutaml/model/schema/renderers/model.rb +121 -0
  71. data/lib/lutaml/model/schema/renderers/namespace.rb +30 -0
  72. data/lib/lutaml/model/schema/renderers/registration.rb +64 -0
  73. data/lib/lutaml/model/schema/renderers/required_files_calculator.rb +93 -0
  74. data/lib/lutaml/model/schema/renderers/restricted_type.rb +88 -0
  75. data/lib/lutaml/model/schema/renderers/union.rb +83 -0
  76. data/lib/lutaml/model/schema/renderers.rb +19 -0
  77. data/lib/lutaml/model/schema/rnc_compiler/source_resolver.rb +47 -0
  78. data/lib/lutaml/model/schema/rnc_compiler.rb +62 -0
  79. data/lib/lutaml/model/schema/rng_compiler/define_classifier.rb +91 -0
  80. data/lib/lutaml/model/schema/rng_compiler/element_visitor.rb +392 -0
  81. data/lib/lutaml/model/schema/rng_compiler/member_collector.rb +30 -0
  82. data/lib/lutaml/model/schema/rng_compiler/rng_helpers.rb +152 -0
  83. data/lib/lutaml/model/schema/rng_compiler/value_type_resolver.rb +125 -0
  84. data/lib/lutaml/model/schema/rng_compiler.rb +220 -0
  85. data/lib/lutaml/model/schema/templates.rb +162 -0
  86. data/lib/lutaml/model/schema/xml_compiler/element_order.rb +41 -0
  87. data/lib/lutaml/model/schema/xml_compiler/registry_generator.rb +31 -107
  88. data/lib/lutaml/model/schema/xml_compiler/spec_builder/complex_types.rb +191 -0
  89. data/lib/lutaml/model/schema/xml_compiler/spec_builder/members.rb +216 -0
  90. data/lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb +153 -0
  91. data/lib/lutaml/model/schema/xml_compiler/spec_builder.rb +167 -0
  92. data/lib/lutaml/model/schema/xml_compiler/supported_data_types.rb +87 -0
  93. data/lib/lutaml/model/schema/xml_compiler.rb +38 -517
  94. data/lib/lutaml/model/schema.rb +19 -0
  95. data/lib/lutaml/model/serialize/attribute_definition.rb +14 -2
  96. data/lib/lutaml/model/serialize/builder.rb +15 -2
  97. data/lib/lutaml/model/serialize/value_mapping.rb +9 -57
  98. data/lib/lutaml/model/serialize.rb +6 -9
  99. data/lib/lutaml/model/services/rule_value_extractor.rb +2 -3
  100. data/lib/lutaml/model/services.rb +0 -2
  101. data/lib/lutaml/model/store.rb +2 -1
  102. data/lib/lutaml/model/toml.rb +1 -1
  103. data/lib/lutaml/model/transform.rb +17 -39
  104. data/lib/lutaml/model/transformation_registry.rb +1 -1
  105. data/lib/lutaml/model/type.rb +1 -0
  106. data/lib/lutaml/model/union.rb +320 -0
  107. data/lib/lutaml/model/utils.rb +6 -0
  108. data/lib/lutaml/model/validation.rb +1 -4
  109. data/lib/lutaml/model/version.rb +1 -1
  110. data/lib/lutaml/model.rb +19 -0
  111. data/lib/lutaml/{jsonld → rdf}/context.rb +1 -1
  112. data/lib/lutaml/{jsonld/transform.rb → rdf/linked_data_transform.rb} +33 -35
  113. data/lib/lutaml/{jsonld → rdf}/term_definition.rb +1 -1
  114. data/lib/lutaml/rdf.rb +3 -0
  115. data/lib/lutaml/toml.rb +1 -1
  116. data/lib/lutaml/xml/adapter.rb +1 -1
  117. data/lib/lutaml/xml/adapter_element.rb +2 -2
  118. data/lib/lutaml/xml/adapter_loader.rb +1 -1
  119. data/lib/lutaml/xml/builder/base.rb +1 -1
  120. data/lib/lutaml/xml/builder.rb +1 -1
  121. data/lib/lutaml/xml/error/schema_validation_error.rb +25 -0
  122. data/lib/lutaml/xml/model_transform.rb +5 -1
  123. data/lib/lutaml/xml/schema/relaxng_schema.rb +5 -0
  124. data/lib/lutaml/xml/schema/xsd_schema.rb +4 -0
  125. data/lib/lutaml/xml/serialization/format_conversion.rb +48 -0
  126. data/lib/lutaml/xml/serialization/instance_methods.rb +13 -0
  127. data/lib/lutaml/xml/transformation/element_builder.rb +59 -31
  128. data/lib/lutaml/xml/transformation/ordered_applier.rb +6 -0
  129. data/lib/lutaml/xml/xsd_validator.rb +66 -0
  130. data/lib/lutaml/xml.rb +53 -12
  131. data/lib/lutaml/yamlld/adapter.rb +25 -0
  132. data/lib/lutaml/yamlld.rb +25 -0
  133. data/lutaml-model.gemspec +4 -2
  134. data/spec/fixtures/xml/schema/rnc/address_book.rnc +15 -0
  135. data/spec/fixtures/xml/schema/rnc/book_features.rnc +18 -0
  136. data/spec/fixtures/xml/schema/rnc/includes/book.rnc +6 -0
  137. data/spec/fixtures/xml/schema/rnc/includes/circular_a.rnc +8 -0
  138. data/spec/fixtures/xml/schema/rnc/includes/circular_b.rnc +8 -0
  139. data/spec/fixtures/xml/schema/rnc/includes/library.rnc +8 -0
  140. data/spec/fixtures/xml/schema/rng/address_book.rng +16 -0
  141. data/spec/fixtures/xml/schema/rng/book.rng +27 -0
  142. data/spec/fixtures/xml/schema/rng/fixed_value.rng +11 -0
  143. data/spec/fixtures/xml/schema/rng/fragment_in_choice.rng +30 -0
  144. data/spec/fixtures/xml/schema/rng/full_name.rng +39 -0
  145. data/spec/fixtures/xml/schema/rng/integer_range.rng +32 -0
  146. data/spec/fixtures/xml/schema/rng/list_type.rng +12 -0
  147. data/spec/fixtures/xml/schema/rng/namespaced.rng +9 -0
  148. data/spec/fixtures/xml/schema/rng/paragraph.rng +13 -0
  149. data/spec/fixtures/xml/schema/rng/person.rng +23 -0
  150. data/spec/fixtures/xml/schema/rng/union.rng +14 -0
  151. data/spec/fixtures/xml/validate_xml_with_address.xsd +13 -0
  152. data/spec/fixtures/xml/validate_xml_with_contact.xsd +11 -0
  153. data/spec/fixtures/xml/validate_xml_with_person.xsd +11 -0
  154. data/spec/fixtures/xml/validate_xml_with_person_strict.xsd +17 -0
  155. data/spec/fixtures/xml/validate_xml_with_product.xsd +37 -0
  156. data/spec/lutaml/integration/multi_format_spec.rb +23 -0
  157. data/spec/lutaml/model/attribute_apply_value_map_spec.rb +134 -0
  158. data/spec/lutaml/model/attribute_spec.rb +177 -13
  159. data/spec/lutaml/model/boot_manifest_spec.rb +30 -0
  160. data/spec/lutaml/model/choice_restrict_spec.rb +225 -0
  161. data/spec/lutaml/model/collection_spec.rb +18 -0
  162. data/spec/lutaml/model/custom_model_spec.rb +4 -4
  163. data/spec/lutaml/model/mixed_content_spec.rb +173 -2
  164. data/spec/lutaml/model/multiple_mapping_spec.rb +4 -4
  165. data/spec/lutaml/model/opal_smoke_spec.rb +67 -2
  166. data/spec/lutaml/model/ordered_content_spec.rb +33 -3
  167. data/spec/lutaml/model/raw_element_spec.rb +125 -0
  168. data/spec/lutaml/model/rule_value_extractor_spec.rb +7 -14
  169. data/spec/lutaml/model/runtime_compatibility_spec.rb +25 -0
  170. data/spec/lutaml/model/schema/renderers/model_spec.rb +149 -0
  171. data/spec/lutaml/model/schema/renderers/namespace_spec.rb +36 -0
  172. data/spec/lutaml/model/schema/renderers/restricted_type_spec.rb +75 -0
  173. data/spec/lutaml/model/schema/renderers/union_spec.rb +58 -0
  174. data/spec/lutaml/model/transform_apply_value_map_spec.rb +64 -0
  175. data/spec/lutaml/model/uninitialized_class_spec.rb +1 -1
  176. data/spec/lutaml/model/union_attribute_spec.rb +658 -0
  177. data/spec/lutaml/model/union_spec.rb +257 -0
  178. data/spec/lutaml/model/utils_spec.rb +14 -0
  179. data/spec/lutaml/model/xsd_form_default_patterns_spec.rb +2 -2
  180. data/spec/lutaml/model/xsd_patterns_spec.rb +4 -4
  181. data/spec/lutaml/{jsonld → rdf}/context_spec.rb +2 -2
  182. data/spec/lutaml/{jsonld/transform_spec.rb → rdf/linked_data_transform_spec.rb} +15 -1
  183. data/spec/lutaml/{jsonld → rdf}/term_definition_spec.rb +2 -2
  184. data/spec/lutaml/turtle/transform_spec.rb +2 -2
  185. data/spec/lutaml/xml/enhanced_mapping_spec.rb +230 -1
  186. data/spec/lutaml/xml/mapping_spec.rb +4 -4
  187. data/spec/lutaml/xml/namespace_placement_spec.rb +11 -8
  188. data/spec/lutaml/xml/namespace_three_phase_spec.rb +1 -1
  189. data/spec/lutaml/xml/opal_xml_spec.rb +22 -20
  190. data/spec/lutaml/xml/prefix_control_spec.rb +4 -4
  191. data/spec/lutaml/xml/schema/compiler_spec.rb +21 -4
  192. data/spec/lutaml/xml/schema/rnc_compiler_spec.rb +404 -0
  193. data/spec/lutaml/xml/schema/rng_compiler_spec.rb +893 -0
  194. data/spec/lutaml/xml/serializable_namespace_spec.rb +6 -6
  195. data/spec/lutaml/xml/type_namespace_examples_spec.rb +1 -1
  196. data/spec/lutaml/xml/type_namespace_integration_spec.rb +3 -3
  197. data/spec/lutaml/xml/validate_xml_with_constructs_spec.rb +222 -0
  198. data/spec/lutaml/xml/validate_xml_with_spec.rb +186 -0
  199. data/spec/lutaml/yamlld/adapter_spec.rb +56 -0
  200. data/spec/lutaml/yamlld/registration_spec.rb +33 -0
  201. data/spec/spec_helper.rb +28 -11
  202. data/spec/support/opal.rb +5 -2
  203. metadata +108 -37
  204. data/lib/lutaml/model/schema/xml_compiler/attribute.rb +0 -106
  205. data/lib/lutaml/model/schema/xml_compiler/attribute_group.rb +0 -47
  206. data/lib/lutaml/model/schema/xml_compiler/choice.rb +0 -67
  207. data/lib/lutaml/model/schema/xml_compiler/complex_content.rb +0 -27
  208. data/lib/lutaml/model/schema/xml_compiler/complex_content_restriction.rb +0 -34
  209. data/lib/lutaml/model/schema/xml_compiler/complex_type.rb +0 -173
  210. data/lib/lutaml/model/schema/xml_compiler/element.rb +0 -121
  211. data/lib/lutaml/model/schema/xml_compiler/group.rb +0 -113
  212. data/lib/lutaml/model/schema/xml_compiler/restriction.rb +0 -104
  213. data/lib/lutaml/model/schema/xml_compiler/sequence.rb +0 -52
  214. data/lib/lutaml/model/schema/xml_compiler/simple_content.rb +0 -40
  215. data/lib/lutaml/model/schema/xml_compiler/simple_type.rb +0 -265
  216. data/lib/lutaml/model/schema/xml_compiler/xml_namespace_class.rb +0 -110
  217. data/lib/lutaml/model/services/default_value_resolver.rb +0 -60
  218. data/spec/lutaml/model/services/default_value_resolver_spec.rb +0 -162
  219. data/spec/lutaml/xml/schema/compiler/attribute_group_spec.rb +0 -71
  220. data/spec/lutaml/xml/schema/compiler/attribute_spec.rb +0 -67
  221. data/spec/lutaml/xml/schema/compiler/choice_spec.rb +0 -74
  222. data/spec/lutaml/xml/schema/compiler/complex_content_restriction_spec.rb +0 -60
  223. data/spec/lutaml/xml/schema/compiler/complex_content_spec.rb +0 -41
  224. data/spec/lutaml/xml/schema/compiler/complex_type_spec.rb +0 -202
  225. data/spec/lutaml/xml/schema/compiler/element_spec.rb +0 -68
  226. data/spec/lutaml/xml/schema/compiler/group_spec.rb +0 -90
  227. data/spec/lutaml/xml/schema/compiler/restriction_spec.rb +0 -77
  228. data/spec/lutaml/xml/schema/compiler/sequence_spec.rb +0 -65
  229. data/spec/lutaml/xml/schema/compiler/simple_content_spec.rb +0 -61
  230. data/spec/lutaml/xml/schema/compiler/simple_type_spec.rb +0 -184
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b419ac1cce55a5e56ca59dd217042047801d2420751f89ce0b875558e517f44
4
- data.tar.gz: ed7c6b7dcd749c35d7fa434d2adf4b9e036c7329afd80c2420ef75f57f65895f
3
+ metadata.gz: 852a93ce391ef7eb0f8e7673bda66f7bb417637b252735cebe833d1e305a6c7b
4
+ data.tar.gz: 65f067c3e0bf4e1d520d5e2d133a6de4606900844b5e91d367ce4edee51da0e1
5
5
  SHA512:
6
- metadata.gz: c923ed6933f06ca678d4b76c19b46553f1196e0b30c0f202113a792619c91c0e6b3e3885963f4b910d101722d0cee22df8bf71c0c593fc7de4f0832d9062d87d
7
- data.tar.gz: cfc1cc06ebeb1affa7875ecc522d8625147f70ed81aa6ae2feb2b4debd92f652ce2cf565f9984e52170e65559a75f23139c85762df5018545b60187cb5974744
6
+ metadata.gz: 318f15b16d919319fd4c2cd9c2722a1ee37b8f1a4272b5a966ce45bf2811447c7c1004642fd76c3204ddd70c8fb4ac6de9397e67f7305529e4b2310769fca52b
7
+ data.tar.gz: 65479ec0a4e9ef58938953f94802da282bfe2d443c4d7cd41a9bf83973e653c3d6ce700fb9eb07e7e5cf1ffa120cfb54fded8d71d8215f4e35c76360dd6393fe
@@ -42,16 +42,42 @@ jobs:
42
42
  - uses: actions/checkout@v6
43
43
  with:
44
44
  fetch-depth: 0
45
+ submodules: "recursive"
45
46
 
46
47
  - name: Create main worktree for baseline
47
48
  run: |
48
49
  git worktree add /tmp/main-checkout origin/main
50
+ (cd /tmp/main-checkout && git submodule update --init --recursive)
49
51
 
50
52
  - name: Set up Ruby
51
53
  uses: ruby/setup-ruby@v1
52
54
  with:
53
55
  ruby-version: '3.4'
54
- bundler-cache: true
56
+ bundler-cache: false
57
+
58
+ - name: Install ragel
59
+ run: sudo apt-get update && sudo apt-get install -y ragel
60
+
61
+ - name: Install ruby-ll (for rake vendor:prepare)
62
+ run: gem install ruby-ll --no-document
63
+
64
+ - name: Generate ragel / ruby-ll outputs in vendored forks (current)
65
+ run: rake vendor:prepare
66
+
67
+ - name: Generate ragel / ruby-ll outputs in vendored forks (main baseline)
68
+ run: (cd /tmp/main-checkout && rake vendor:prepare)
69
+
70
+ - name: Configure bundler
71
+ run: |
72
+ mkdir -p .bundle
73
+ echo "---" > .bundle/config
74
+ echo 'BUNDLE_BUILD__RUBY___LL: "--with-cflags=-std=gnu17"' >> .bundle/config
75
+
76
+ - name: Compile liboga / libll native extensions (current)
77
+ run: rake vendor:compile
78
+
79
+ - name: Compile liboga / libll native extensions (main baseline)
80
+ run: (cd /tmp/main-checkout && rake vendor:compile)
55
81
 
56
82
  - name: Checkout downstream (${{ matrix.repo }})
57
83
  uses: actions/checkout@v6
@@ -0,0 +1,102 @@
1
+ name: js-pr-check
2
+
3
+ # On PRs that touch lib/, Gemfile, Rakefile, or .gitmodules, fire a
4
+ # repository_dispatch at lutaml-model-js so it builds a test artifact
5
+ # and runs the JS smoke tests against the PR head. Does NOT publish.
6
+ # Catches JS regressions before the Ruby PR merges.
7
+ #
8
+ # PAT token: LUTAML_CI_PAT_TOKEN must have `repo` scope on
9
+ # lutaml/lutaml-model-js. Note that PRs from forks of lutaml/lutaml-model
10
+ # will not have access to the PAT (GitHub masks secrets on fork PRs);
11
+ # those builds will be skipped — contributors from forks should run
12
+ # `gh workflow run js-pr-check` manually after pushing to a branch on
13
+ # the origin repo.
14
+
15
+ on:
16
+ pull_request:
17
+ paths:
18
+ - 'lib/**'
19
+ - 'Gemfile'
20
+ - 'gemspec'
21
+ - 'Rakefile'
22
+ - '.gitmodules'
23
+ - '.github/workflows/js-pr-check.yml'
24
+ workflow_dispatch:
25
+ inputs:
26
+ pr_number:
27
+ description: PR number to test (for manual reruns).
28
+ required: true
29
+
30
+ permissions:
31
+ contents: read
32
+ pull-requests: write
33
+
34
+ jobs:
35
+ trigger:
36
+ runs-on: ubuntu-latest
37
+ if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == 'lutaml/lutaml-model' }}
38
+ steps:
39
+ - uses: actions/checkout@v6
40
+ with:
41
+ # Need the PR head, not the merge commit, so the SHA the JS
42
+ # build pulls matches what reviewers see.
43
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
44
+ fetch-depth: 0
45
+
46
+ - name: Resolve PR inputs
47
+ id: pr
48
+ uses: actions/github-script@v7
49
+ with:
50
+ script: |
51
+ const prNumber = context.payload.inputs?.pr_number
52
+ ? parseInt(context.payload.inputs.pr_number, 10)
53
+ : context.payload.pull_request?.number;
54
+ if (!prNumber) {
55
+ core.setFailed("No PR number available");
56
+ return;
57
+ }
58
+ const { data: pr } = await github.rest.pulls.get({
59
+ owner: context.repo.owner,
60
+ repo: context.repo.repo,
61
+ pull_number: prNumber,
62
+ });
63
+ core.setOutput("number", String(prNumber));
64
+ core.setOutput("sha", pr.head.sha);
65
+ core.setOutput("ref", pr.head.ref);
66
+ core.setOutput("repo", pr.head.repo.full_name);
67
+
68
+ - name: Notify lutaml-model-js
69
+ uses: peter-evans/repository-dispatch@v3
70
+ with:
71
+ token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
72
+ repository: lutaml/lutaml-model-js
73
+ event-type: js-pr-check
74
+ client-payload: |-
75
+ {
76
+ "pr_number": ${{ steps.pr.outputs.number }},
77
+ "sha": "${{ steps.pr.outputs.sha }}",
78
+ "ref": "${{ steps.pr.outputs.ref }}",
79
+ "repo": "${{ steps.pr.outputs.repo }}"
80
+ }
81
+
82
+ - name: Annotate PR with build link
83
+ if: ${{ github.event_name == 'pull_request' }}
84
+ uses: actions/github-script@v7
85
+ with:
86
+ script: |
87
+ const body = [
88
+ "### JS build check",
89
+ "",
90
+ "Triggered [`js-pr-check`]",
91
+ `(https://github.com/lutaml/lutaml-model-js/actions/workflows/pr-check.yml)`,
92
+ "against this PR's head (`" + context.payload.pull_request.head.sha.substring(0, 7) + "`).",
93
+ "",
94
+ "The result will appear as a `lutaml-model-js / pr-check` status check",
95
+ "on this PR once the workflow run completes.",
96
+ ].join("\n");
97
+ await github.rest.issues.createComment({
98
+ owner: context.repo.owner,
99
+ repo: context.repo.repo,
100
+ issue_number: context.payload.pull_request.number,
101
+ body,
102
+ });
@@ -0,0 +1,51 @@
1
+ name: js-sync
2
+
3
+ # On every push to main, fire a repository_dispatch at lutaml-model-js
4
+ # so it rebuilds and publishes under the npm `next` dist-tag. This
5
+ # closes the dev-build gap: JS consumers can track Ruby main without
6
+ # waiting for a stable gem release.
7
+ #
8
+ # PAT token: LUTAML_CI_PAT_TOKEN must have `repo` scope on
9
+ # lutaml/lutaml-model-js. Same token already used by release.yml.
10
+
11
+ on:
12
+ push:
13
+ branches: [main]
14
+ workflow_dispatch:
15
+ inputs:
16
+ sha:
17
+ description: Specific SHA to build from (defaults to HEAD on main).
18
+ required: false
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ jobs:
24
+ trigger:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v6
28
+ with:
29
+ fetch-depth: 0
30
+
31
+ - name: Resolve SHA
32
+ id: sha
33
+ run: |
34
+ if [ -n "${{ github.event.inputs.sha }}" ]; then
35
+ echo "sha=${{ github.event.inputs.sha }}" >> "$GITHUB_OUTPUT"
36
+ else
37
+ echo "sha=${{ github.sha }}" >> "$GITHUB_OUTPUT"
38
+ fi
39
+
40
+ - name: Notify lutaml-model-js
41
+ uses: peter-evans/repository-dispatch@v3
42
+ with:
43
+ token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
44
+ repository: lutaml/lutaml-model-js
45
+ event-type: js-sync-main
46
+ client-payload: |-
47
+ {
48
+ "sha": "${{ steps.sha.outputs.sha }}",
49
+ "ref": "${{ github.ref }}",
50
+ "ruby_ref": "main"
51
+ }
@@ -3,29 +3,49 @@ name: opal
3
3
  on:
4
4
  push:
5
5
  branches: [main]
6
+ tags: [ v* ]
6
7
  pull_request:
7
8
 
9
+ permissions:
10
+ contents: read
11
+
8
12
  jobs:
9
13
  test:
10
14
  runs-on: ubuntu-latest
11
15
  steps:
12
- - uses: actions/checkout@v4
16
+ - uses: actions/checkout@v6
13
17
  with:
14
18
  submodules: "recursive"
15
19
 
16
20
  - name: Set up Ruby
17
21
  uses: ruby/setup-ruby@v1
18
22
  with:
19
- ruby-version: "3.3"
20
- bundler-cache: true
23
+ ruby-version: "3.4"
24
+ # bundler-cache disabled: the path-source oga and ruby-ll forks
25
+ # need ragel + ruby-ll outputs generated (rake vendor:prepare)
26
+ # before their C extensions can compile.
27
+ bundler-cache: false
21
28
 
22
29
  - name: Set up Node.js
23
30
  uses: actions/setup-node@v4
24
31
  with:
25
32
  node-version: "18"
26
33
 
34
+ - name: Install ragel
35
+ run: sudo apt-get update && sudo apt-get install -y ragel
36
+
37
+ - name: Install ruby-ll (for rake vendor:prepare)
38
+ run: gem install ruby-ll --no-document
39
+
40
+ - name: Generate ragel / ruby-ll outputs in vendored forks
41
+ # Run before bundle install: the path-source oga/ruby-ll forks
42
+ # gitignore their generated .rb/.c files. bundle install compiles
43
+ # the C extensions via each fork's extconf.rb, which needs
44
+ # ext/c/lexer.c to exist.
45
+ run: rake vendor:prepare
46
+
47
+ - name: Install dependencies
48
+ run: bundle install
49
+
27
50
  - name: Run Opal tests
28
- # TODO: Remove continue-on-error once REXML adapter is verified
29
- # under actual Opal runtime (REXML compiles to JS via Opal's stdlib)
30
51
  run: bundle exec rake spec:opal
31
- continue-on-error: true
@@ -19,15 +19,40 @@ jobs:
19
19
  timeout-minutes: 20
20
20
  steps:
21
21
  - uses: actions/checkout@v6
22
- - name: Configure bundle for LLM extension
23
- run: |
24
- mkdir -p .bundle
25
- echo "---" > .bundle/config
26
- echo 'BUNDLE_BUILD__RUBY___LL: "--with-cflags=-std=gnu17"' >> .bundle/config
22
+ with:
23
+ submodules: "recursive"
24
+
27
25
  - name: Set up Ruby
28
26
  uses: ruby/setup-ruby@v1
29
27
  with:
30
28
  ruby-version: '3.4'
31
- bundler-cache: true
29
+ # bundler-cache disabled: must run rake vendor:prepare before
30
+ # bundle install can compile the path-source forks' C extensions.
31
+ bundler-cache: false
32
+
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
+ - name: Configure bundler
46
+ run: |
47
+ mkdir -p .bundle
48
+ echo "---" > .bundle/config
49
+ echo 'BUNDLE_BUILD__RUBY___LL: "--with-cflags=-std=gnu17"' >> .bundle/config
50
+
51
+ - name: Install dependencies
52
+ run: bundle install
53
+
54
+ - name: Compile liboga / libll native extensions
55
+ run: rake vendor:compile
56
+
32
57
  - name: Run performance benchmarks
33
- run: bundle exec rake performance:compare
58
+ run: bundle exec rake performance:compare
@@ -1,40 +1,86 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
1
  name: rake
4
2
 
5
- concurrency:
6
- group: ${{ github.workflow }}-${{ github.ref }}
7
- cancel-in-progress: true
8
-
9
- permissions:
10
- contents: write
11
-
12
3
  on:
13
4
  push:
14
- branches: [ master, main ]
5
+ branches: [ main ]
15
6
  tags: [ v* ]
16
- paths-ignore:
17
- - '**.adoc'
18
- - 'docs/**'
19
- - '*.md'
20
- - 'LICENSE'
21
7
  pull_request:
22
- paths-ignore:
23
- - '**.adoc'
24
- - 'docs/**'
25
- - '*.md'
26
- - 'LICENSE'
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: ${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: true
27
15
 
28
16
  jobs:
29
- rake:
30
- uses: metanorma/ci/.github/workflows/generic-rake.yml@main
31
- with:
32
- before-setup-ruby: |
33
- mkdir -p .bundle
34
- touch .bundle/config
35
- cat .bundle/config
36
- echo "---" >> .bundle/config
37
- echo 'BUNDLE_BUILD__RUBY___LL: "--with-cflags=-std=gnu17"' >> .bundle/config
38
- cat .bundle/config
39
- secrets:
40
- pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
17
+ test:
18
+ runs-on: ${{ matrix.os }}
19
+ continue-on-error: ${{ matrix.experimental }}
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ os: [ubuntu-latest, macos-latest, windows-latest]
24
+ ruby: ["3.3", "3.4", "4.0"]
25
+ experimental: [false]
26
+ include:
27
+ - os: windows-latest
28
+ experimental: true
29
+ steps:
30
+ - uses: actions/checkout@v6
31
+ with:
32
+ submodules: "recursive"
33
+
34
+ - name: Set up Ruby
35
+ uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ${{ matrix.ruby }}
38
+ # bundler-cache disabled: the path-source oga and ruby-ll forks
39
+ # need ragel + ruby-ll outputs generated (rake vendor:prepare)
40
+ # before their C extensions can compile.
41
+ bundler-cache: false
42
+
43
+ - name: Install ragel (Linux)
44
+ if: runner.os == 'Linux'
45
+ run: sudo apt-get update && sudo apt-get install -y ragel
46
+
47
+ - name: Install ragel (macOS)
48
+ if: runner.os == 'macOS'
49
+ run: brew install ragel
50
+
51
+ - name: Install ragel (Windows)
52
+ if: runner.os == 'Windows'
53
+ run: choco install -y ragel
54
+ continue-on-error: true
55
+
56
+ - name: Install ruby-ll (for rake vendor:prepare)
57
+ run: gem install ruby-ll --no-document
58
+
59
+ - name: Generate ragel / ruby-ll outputs in vendored forks
60
+ # Run before bundle install: the path-source oga/ruby-ll forks
61
+ # gitignore their generated .rb/.c files. bundle install compiles
62
+ # the C extensions via each fork's extconf.rb, which needs
63
+ # ext/c/lexer.c to exist.
64
+ run: rake vendor:prepare
65
+
66
+ - name: Configure bundler
67
+ # ruby-ll's C extension needs an older C standard on some compilers.
68
+ run: |
69
+ mkdir -p .bundle
70
+ echo '---' > .bundle/config
71
+ echo 'BUNDLE_BUILD__RUBY___LL: "--with-cflags=-std=gnu17"' >> .bundle/config
72
+
73
+ - name: Install dependencies
74
+ run: bundle install
75
+
76
+ - name: Compile liboga / libll native extensions
77
+ # Bundler does not reliably build path-source gems' native
78
+ # extensions; compile them explicitly so `require "oga"` (which
79
+ # requires libll) resolves under CRuby.
80
+ run: rake vendor:compile
81
+
82
+ - name: Run tests
83
+ run: bundle exec rake spec
84
+
85
+ - name: Run rubocop
86
+ run: bundle exec rake rubocop
@@ -23,9 +23,6 @@ jobs:
23
23
  uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
24
24
  with:
25
25
  next_version: ${{ github.event.inputs.next_version }}
26
- post_install: |
27
- git status
28
- cat .bundle/config
29
26
  secrets:
30
27
  rubygems-api-key: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
31
28
  pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
data/.gitmodules ADDED
@@ -0,0 +1,6 @@
1
+ [submodule "vendor/opal-oga"]
2
+ path = vendor/opal-oga
3
+ url = https://github.com/lutaml/opal-oga.git
4
+ [submodule "vendor/opal-ruby-ll"]
5
+ path = vendor/opal-ruby-ll
6
+ url = https://github.com/lutaml/opal-ruby-ll.git
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-06-05 08:01:07 UTC using RuboCop version 1.87.0.
3
+ # on 2026-06-08 11:45:37 UTC using RuboCop version 1.87.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -11,13 +11,66 @@ Gemspec/RequiredRubyVersion:
11
11
  Exclude:
12
12
  - 'lutaml-model.gemspec'
13
13
 
14
- # Offense count: 3052
14
+ # Offense count: 1
15
+ # This cop supports safe autocorrection (--autocorrect).
16
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
17
+ # SupportedStyles: with_first_argument, with_fixed_indentation
18
+ Layout/ArgumentAlignment:
19
+ Exclude:
20
+ - 'lib/lutaml/rdf/linked_data_transform.rb'
21
+
22
+ # Offense count: 2
23
+ # This cop supports safe autocorrection (--autocorrect).
24
+ # Configuration parameters: EnforcedStyleAlignWith.
25
+ # SupportedStylesAlignWith: either, start_of_block, start_of_line
26
+ Layout/BlockAlignment:
27
+ Exclude:
28
+ - 'spec/lutaml/model/choice_restrict_spec.rb'
29
+
30
+ # Offense count: 2
31
+ # This cop supports safe autocorrection (--autocorrect).
32
+ Layout/BlockEndNewline:
33
+ Exclude:
34
+ - 'spec/lutaml/model/choice_restrict_spec.rb'
35
+
36
+ # Offense count: 2
37
+ # This cop supports safe autocorrection (--autocorrect).
38
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
39
+ # SupportedStyles: special_inside_parentheses, consistent, align_brackets
40
+ Layout/FirstArrayElementIndentation:
41
+ Exclude:
42
+ - 'spec/lutaml/model/choice_restrict_spec.rb'
43
+
44
+ # Offense count: 4
45
+ # This cop supports safe autocorrection (--autocorrect).
46
+ # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
47
+ # SupportedStylesAlignWith: start_of_line, relative_to_receiver
48
+ Layout/IndentationWidth:
49
+ Exclude:
50
+ - 'spec/lutaml/model/choice_restrict_spec.rb'
51
+
52
+ # Offense count: 3071
15
53
  # This cop supports safe autocorrection (--autocorrect).
16
54
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
17
55
  # URISchemes: http, https
18
56
  Layout/LineLength:
19
57
  Enabled: false
20
58
 
59
+ # Offense count: 1
60
+ # This cop supports safe autocorrection (--autocorrect).
61
+ # Configuration parameters: EnforcedStyle.
62
+ # SupportedStyles: symmetrical, new_line, same_line
63
+ Layout/MultilineArrayBraceLayout:
64
+ Exclude:
65
+ - 'spec/lutaml/model/choice_restrict_spec.rb'
66
+
67
+ # Offense count: 1
68
+ # This cop supports safe autocorrection (--autocorrect).
69
+ # Configuration parameters: AllowInHeredoc.
70
+ Layout/TrailingWhitespace:
71
+ Exclude:
72
+ - 'lib/lutaml/rdf/linked_data_transform.rb'
73
+
21
74
  # Offense count: 21
22
75
  # Configuration parameters: AllowedMethods.
23
76
  # AllowedMethods: enums
@@ -232,7 +285,7 @@ RSpec/BeforeAfterAll:
232
285
  RSpec/ContextWording:
233
286
  Enabled: false
234
287
 
235
- # Offense count: 101
288
+ # Offense count: 102
236
289
  # Configuration parameters: IgnoredMetadata.
237
290
  RSpec/DescribeClass:
238
291
  Enabled: false
@@ -243,7 +296,7 @@ RSpec/DescribeMethod:
243
296
  - 'spec/lutaml/xml/schema/xsd/schema_helper_methods_spec.rb'
244
297
  - 'spec/lutaml/xml/serializable_namespace_spec.rb'
245
298
 
246
- # Offense count: 1328
299
+ # Offense count: 1343
247
300
  # Configuration parameters: CountAsOne.
248
301
  RSpec/ExampleLength:
249
302
  Max: 68
@@ -318,7 +371,7 @@ RSpec/MultipleDescribes:
318
371
  - 'spec/lutaml/xml/namespace_resolution_strategy_spec.rb'
319
372
  - 'spec/lutaml/xml/xml_space_type_spec.rb'
320
373
 
321
- # Offense count: 1560
374
+ # Offense count: 1576
322
375
  RSpec/MultipleExpectations:
323
376
  Max: 21
324
377
 
@@ -366,7 +419,7 @@ RSpec/RepeatedExampleGroupDescription:
366
419
  Exclude:
367
420
  - 'spec/lutaml/model/mixed_content_spec.rb'
368
421
 
369
- # Offense count: 40
422
+ # Offense count: 39
370
423
  # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
371
424
  # SupportedInflectors: default, active_support
372
425
  RSpec/SpecFilePathFormat:
@@ -392,6 +445,17 @@ Security/MarshalLoad:
392
445
  Exclude:
393
446
  - 'scripts-xmi-profile/profile_xmi.rb'
394
447
 
448
+ # Offense count: 3
449
+ # This cop supports safe autocorrection (--autocorrect).
450
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
451
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
452
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
453
+ # FunctionalMethods: let, let!, subject, watch
454
+ # AllowedMethods: lambda, proc, it
455
+ Style/BlockDelimiters:
456
+ Exclude:
457
+ - 'spec/lutaml/model/choice_restrict_spec.rb'
458
+
395
459
  # Offense count: 2
396
460
  # This cop supports unsafe autocorrection (--autocorrect-all).
397
461
  # Configuration parameters: AllowedMethods, AllowedPatterns.
@@ -485,10 +549,10 @@ Style/StringConcatenation:
485
549
  - 'lib/lutaml/model/schema/xml_compiler/simple_type.rb'
486
550
  - 'lib/lutaml/model/schema/xml_compiler/xml_namespace_class.rb'
487
551
 
488
- # Offense count: 3
489
- # This cop supports safe autocorrection (--autocorrect).
490
- # Configuration parameters: EnforcedStyleForMultiline.
491
- # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
492
- Style/TrailingCommaInArguments:
552
+ # Offense count: 1
553
+ # child_names_set may be a Set; Array#intersect? requires an Array, so
554
+ # the autocorrect from rubocop 1.88.2's Style/ArrayIntersect would
555
+ # break runtime. Use the block form.
556
+ Style/ArrayIntersect:
493
557
  Exclude:
494
- - 'spec/lutaml/model/raw_element_spec.rb'
558
+ - 'lib/lutaml/xml/model_transform.rb'
data/Gemfile CHANGED
@@ -5,6 +5,14 @@ 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
+ gem "oga", path: "vendor/opal-oga"
14
+ gem "ruby-ll", path: "vendor/opal-ruby-ll"
15
+
8
16
  # needed for liquid with ruby 3.4
9
17
  gem "base64"
10
18
  gem "benchmark-ips"
@@ -14,13 +22,14 @@ gem "json-ld"
14
22
  gem "liquid", "~> 5"
15
23
  gem "multi_json"
16
24
  gem "nokogiri"
17
- gem "oga"
18
25
  gem "oj"
19
26
  gem "openssl", "~> 3.0"
20
27
  gem "ox"
21
28
  gem "rake"
22
29
  gem "rdf-turtle"
23
30
  gem "rexml"
31
+ # TODO: revert rng branch to main when lutaml/rng#32 is merged
32
+ gem "rng", git: "https://github.com/lutaml/rng", branch: "main"
24
33
  gem "rspec"
25
34
  gem "rubocop"
26
35
  gem "rubocop-performance", require: false
@@ -32,3 +41,9 @@ gem "toml-rb"
32
41
  # ruby-prof works on all platforms including Windows (unlike stackprof)
33
42
  # Provides both CPU and memory profiling
34
43
  gem "ruby-prof", group: :development
44
+
45
+ group :opal do
46
+ gem "opal", "~> 1.8"
47
+ gem "opal-rspec", "~> 1.0"
48
+ gem "opal-sprockets"
49
+ end