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.
- checksums.yaml +4 -4
- data/.github/scripts/test_installed_gem.rb +1 -13
- data/.github/workflows/downstream-performance.yml +1 -22
- data/.github/workflows/performance.yml +1 -33
- data/.github/workflows/rake.yml +2 -6
- data/.rubocop.yml +0 -10
- data/.rubocop_todo.yml +0 -4
- data/Gemfile +0 -23
- data/README.adoc +25 -86
- data/Rakefile +2 -167
- data/docs/_guides/advanced-mapping.adoc +6 -6
- data/docs/_guides/character-encoding.adoc +0 -3
- data/docs/_guides/gem-integration.adoc +1 -1
- data/docs/_guides/index.adoc +0 -4
- data/docs/_guides/xml/type-namespaces.adoc +1 -1
- data/docs/_guides/xml-guide-0.8.0.adoc +2 -2
- data/docs/_guides/xml-namespaces.adoc +2 -3
- data/docs/_guides/xml_mappings/03_architecture.adoc +2 -2
- data/docs/_guides/xml_mappings/07_best_practices.adoc +2 -3
- data/docs/_guides/xml_mappings/08_troubleshooting.adoc +1 -9
- data/docs/_pages/comparison-with-shale.adoc +1 -1
- data/docs/_pages/configuration.adoc +6 -40
- data/docs/_pages/index.adoc +0 -1
- data/docs/_pages/serialization_adapters.adoc +4 -16
- data/docs/_references/architecture.adoc +1 -1
- data/docs/_references/lutaml-namespace-planning.md +1 -1
- data/docs/_references/three-phase-namespace-architecture.adoc +1 -2
- data/docs/_references/xsd-generation-with-namespace-support.adoc +3 -8
- data/docs/_tutorials/lutaml-xml-architecture.adoc +2 -8
- data/docs/architecture.md +7 -11
- data/docs/conversion_caching.adoc +1 -1
- data/docs/index.adoc +0 -1
- data/docs/key_value_data_model.adoc +1 -1
- data/docs/namespace-management.adoc +4 -10
- data/lib/lutaml/json/format.rb +0 -1
- data/lib/lutaml/json/generator_options.rb +0 -1
- data/lib/lutaml/key_value/transform.rb +9 -16
- data/lib/lutaml/lml/document_builder.rb +2 -2
- data/lib/lutaml/lml/entity_types.rb +2 -2
- data/lib/lutaml/model/adapter_resolver.rb +5 -15
- data/lib/lutaml/model/attribute.rb +14 -2
- data/lib/lutaml/model/cached_type_resolver.rb +1 -7
- data/lib/lutaml/model/error/unknown_adapter_type_error.rb +1 -1
- data/lib/lutaml/model/global_context.rb +3 -5
- data/lib/lutaml/model/instrumentation.rb +0 -3
- data/lib/lutaml/model/mapping/mapping_rule.rb +6 -10
- data/lib/lutaml/model/register.rb +20 -31
- data/lib/lutaml/model/runtime_compatibility.rb +0 -92
- data/lib/lutaml/model/schema/class_loader.rb +2 -4
- data/lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb +2 -3
- data/lib/lutaml/model/serialize/attribute_definition.rb +10 -184
- data/lib/lutaml/model/serialize/conversion_caching.rb +1 -5
- data/lib/lutaml/model/serialize/model_import.rb +0 -5
- data/lib/lutaml/model/serialize/value_mapping.rb +0 -3
- data/lib/lutaml/model/services/rule_value_extractor.rb +4 -7
- data/lib/lutaml/model/store.rb +10 -17
- data/lib/lutaml/model/toml.rb +0 -2
- data/lib/lutaml/model/transformation_registry.rb +3 -7
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/model.rb +3 -19
- data/lib/lutaml/toml/format.rb +4 -8
- data/lib/lutaml/xml/adapter/moxml_adapter.rb +1 -7
- data/lib/lutaml/xml/adapter.rb +0 -4
- data/lib/lutaml/xml/adapter_loader.rb +1 -6
- data/lib/lutaml/xml/builder/base.rb +0 -3
- data/lib/lutaml/xml/builder.rb +0 -8
- data/lib/lutaml/xml/data_model.rb +1 -1
- data/lib/lutaml/xml/doctype_extractor.rb +3 -3
- data/lib/lutaml/xml/format.rb +22 -74
- data/lib/lutaml/xml/leptris/plan_compiler.rb +1 -2
- data/lib/lutaml/xml/model_transform.rb +14 -24
- data/lib/lutaml/xml/polymorphic_value_handler.rb +1 -1
- data/lib/lutaml/xml/schema/builder/moxml.rb +1 -1
- data/lib/lutaml/xml/schema/builder.rb +6 -9
- data/lib/lutaml/xml/schema/relaxng_schema.rb +1 -1
- data/lib/lutaml/xml/xml_element.rb +3 -2
- data/lib/lutaml/xml/xsd_validator.rb +4 -11
- data/lib/lutaml/yaml/adapter/yeptris_adapter.rb +2 -2
- data/lib/lutaml/yamls/adapter_loader.rb +1 -5
- data/lib/tasks/performance_comparator.rb +1 -1
- data/lutaml-model.gemspec +3 -8
- data/spec/benchmarks/xml_parsing_benchmark_spec.rb +1 -1
- data/spec/lutaml/json/adapter/standard_adapter_spec.rb +6 -9
- data/spec/lutaml/model/adapter_resolver_yeptris_switch_spec.rb +0 -2
- data/spec/lutaml/model/cached_type_resolver_spec.rb +2 -54
- data/spec/lutaml/model/cdata_spec.rb +2 -15
- data/spec/lutaml/model/encoding_spec.rb +0 -9
- data/spec/lutaml/model/except_spec.rb +0 -7
- data/spec/lutaml/model/json_spec.rb +0 -14
- data/spec/lutaml/model/mixed_content_spec.rb +6 -46
- data/spec/lutaml/model/ordered_content_spec.rb +0 -7
- data/spec/lutaml/model/polymorphic_scalar_member_spec.rb +57 -0
- data/spec/lutaml/model/processing_instruction_spec.rb +0 -6
- data/spec/lutaml/model/runtime_compatibility_spec.rb +0 -37
- data/spec/lutaml/model/serializable_spec.rb +0 -2
- data/spec/lutaml/model/toml_spec.rb +0 -23
- data/spec/lutaml/xml/adapter/base_adapter_regression_spec.rb +0 -4
- data/spec/lutaml/xml/adapter/order_spec.rb +1 -1
- data/spec/lutaml/xml/adapter/xml_namespace_spec.rb +0 -7
- data/spec/lutaml/xml/attribute_namespace_disjointness_spec.rb +6 -6
- data/spec/lutaml/xml/builder/builder_spec.rb +0 -24
- data/spec/lutaml/xml/default_namespace_spec.rb +1 -8
- data/spec/lutaml/xml/doctype_preservation_spec.rb +0 -4
- data/spec/lutaml/xml/entity_fragmentation_spec.rb +0 -6
- data/spec/lutaml/xml/fpi_namespace_spec.rb +0 -21
- data/spec/lutaml/xml/mapping_spec.rb +8 -15
- data/spec/lutaml/xml/namespace_scope_vcard_spec.rb +0 -7
- data/spec/lutaml/xml/namespace_spec.rb +0 -13
- data/spec/lutaml/xml/prefix_control_spec.rb +0 -6
- data/spec/lutaml/xml/schema/builder_moxml_spec.rb +1 -1
- data/spec/lutaml/xml/xml_adapter_spec.rb +0 -7
- data/spec/lutaml/xml/xml_spec.rb +2 -88
- data/spec/spec_helper.rb +5 -24
- data/spec/support/test_adapter_config.rb +6 -6
- metadata +1 -32
- data/.github/workflows/js-pr-check.yml +0 -106
- data/.github/workflows/js-sync.yml +0 -55
- data/.github/workflows/opal.yml +0 -65
- data/.gitmodules +0 -6
- data/.rspec-opal +0 -5
- data/docs/_guides/opal.adoc +0 -232
- data/lib/compat/opal/generate_boot.rb +0 -137
- data/lib/compat/opal/js_bundle_entry.rb +0 -42
- data/lib/compat/opal/lutaml_model_boot.rb +0 -638
- data/lib/compat/opal/monitor.rb +0 -31
- data/lib/compat/opal/moxml/adapter/customized_rexml/entity_reference.rb +0 -9
- data/lib/compat/opal/moxml/adapter/customized_rexml/formatter.rb +0 -225
- data/lib/compat/opal/moxml/adapter/customized_rexml.rb +0 -11
- data/lib/compat/opal/moxml_boot.rb +0 -68
- data/lib/compat/opal/objectspace_shim.rb +0 -23
- data/lib/compat/opal/rexml/namespace.rb +0 -59
- data/lib/compat/opal/rexml/parsers/baseparser.rb +0 -1016
- data/lib/compat/opal/rexml/source.rb +0 -214
- data/lib/compat/opal/rexml/text.rb +0 -426
- data/lib/compat/opal/rexml/xmltokens.rb +0 -45
- data/lib/compat/opal/rexml_compat.rb +0 -85
- data/lib/compat/opal/yaml_compat.rb +0 -32
- data/lib/lutaml/model/cached_type_resolver/mutex_hash_cache.rb +0 -53
- data/lib/lutaml/model/schema/schema_builder/oga.rb +0 -92
- data/lib/lutaml/xml/schema/builder/oga.rb +0 -92
- data/spec/lutaml/model/boot_manifest_spec.rb +0 -30
- data/spec/lutaml/model/opal_smoke_spec.rb +0 -199
- data/spec/lutaml/model/serialize/attribute_definition_block_form_spec.rb +0 -244
- data/spec/lutaml/xml/adapter/oga_adapter_spec.rb +0 -135
- data/spec/lutaml/xml/opal_xml_spec.rb +0 -204
- data/spec/support/opal.rb +0 -9
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lutaml-model
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.202
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -176,18 +176,13 @@ files:
|
|
|
176
176
|
- ".github/workflows/dependent-tests.yml"
|
|
177
177
|
- ".github/workflows/docs.yml"
|
|
178
178
|
- ".github/workflows/downstream-performance.yml"
|
|
179
|
-
- ".github/workflows/js-pr-check.yml"
|
|
180
|
-
- ".github/workflows/js-sync.yml"
|
|
181
|
-
- ".github/workflows/opal.yml"
|
|
182
179
|
- ".github/workflows/performance.yml"
|
|
183
180
|
- ".github/workflows/rake.yml"
|
|
184
181
|
- ".github/workflows/release.yml"
|
|
185
182
|
- ".gitignore"
|
|
186
|
-
- ".gitmodules"
|
|
187
183
|
- ".irbrc"
|
|
188
184
|
- ".pryrc"
|
|
189
185
|
- ".rspec"
|
|
190
|
-
- ".rspec-opal"
|
|
191
186
|
- ".rubocop.yml"
|
|
192
187
|
- ".rubocop_todo.yml"
|
|
193
188
|
- CODE_OF_CONDUCT.md
|
|
@@ -239,7 +234,6 @@ files:
|
|
|
239
234
|
- docs/_guides/missing-values-handling.adoc
|
|
240
235
|
- docs/_guides/native-engines.adoc
|
|
241
236
|
- docs/_guides/ooxml-examples.adoc
|
|
242
|
-
- docs/_guides/opal.adoc
|
|
243
237
|
- docs/_guides/rdf-serialization.adoc
|
|
244
238
|
- docs/_guides/schema-generation.adoc
|
|
245
239
|
- docs/_guides/schema-import.adoc
|
|
@@ -339,22 +333,6 @@ files:
|
|
|
339
333
|
- exe/lutaml-model
|
|
340
334
|
- flake.lock
|
|
341
335
|
- flake.nix
|
|
342
|
-
- lib/compat/opal/generate_boot.rb
|
|
343
|
-
- lib/compat/opal/js_bundle_entry.rb
|
|
344
|
-
- lib/compat/opal/lutaml_model_boot.rb
|
|
345
|
-
- lib/compat/opal/monitor.rb
|
|
346
|
-
- lib/compat/opal/moxml/adapter/customized_rexml.rb
|
|
347
|
-
- lib/compat/opal/moxml/adapter/customized_rexml/entity_reference.rb
|
|
348
|
-
- lib/compat/opal/moxml/adapter/customized_rexml/formatter.rb
|
|
349
|
-
- lib/compat/opal/moxml_boot.rb
|
|
350
|
-
- lib/compat/opal/objectspace_shim.rb
|
|
351
|
-
- lib/compat/opal/rexml/namespace.rb
|
|
352
|
-
- lib/compat/opal/rexml/parsers/baseparser.rb
|
|
353
|
-
- lib/compat/opal/rexml/source.rb
|
|
354
|
-
- lib/compat/opal/rexml/text.rb
|
|
355
|
-
- lib/compat/opal/rexml/xmltokens.rb
|
|
356
|
-
- lib/compat/opal/rexml_compat.rb
|
|
357
|
-
- lib/compat/opal/yaml_compat.rb
|
|
358
336
|
- lib/lutaml/hash_format.rb
|
|
359
337
|
- lib/lutaml/hash_format/adapter.rb
|
|
360
338
|
- lib/lutaml/hash_format/adapter/document.rb
|
|
@@ -545,7 +523,6 @@ files:
|
|
|
545
523
|
- lib/lutaml/model/attribute_validator.rb
|
|
546
524
|
- lib/lutaml/model/cached_type_resolver.rb
|
|
547
525
|
- lib/lutaml/model/cached_type_resolver/concurrent_map_cache.rb
|
|
548
|
-
- lib/lutaml/model/cached_type_resolver/mutex_hash_cache.rb
|
|
549
526
|
- lib/lutaml/model/choice.rb
|
|
550
527
|
- lib/lutaml/model/cli.rb
|
|
551
528
|
- lib/lutaml/model/collection.rb
|
|
@@ -735,7 +712,6 @@ files:
|
|
|
735
712
|
- lib/lutaml/model/schema/rng_compiler/rng_helpers.rb
|
|
736
713
|
- lib/lutaml/model/schema/rng_compiler/value_type_resolver.rb
|
|
737
714
|
- lib/lutaml/model/schema/schema_builder/nokogiri.rb
|
|
738
|
-
- lib/lutaml/model/schema/schema_builder/oga.rb
|
|
739
715
|
- lib/lutaml/model/schema/shared_methods.rb
|
|
740
716
|
- lib/lutaml/model/schema/templates.rb
|
|
741
717
|
- lib/lutaml/model/schema/templates/model.erb
|
|
@@ -981,7 +957,6 @@ files:
|
|
|
981
957
|
- lib/lutaml/xml/schema/builder.rb
|
|
982
958
|
- lib/lutaml/xml/schema/builder/moxml.rb
|
|
983
959
|
- lib/lutaml/xml/schema/builder/nokogiri.rb
|
|
984
|
-
- lib/lutaml/xml/schema/builder/oga.rb
|
|
985
960
|
- lib/lutaml/xml/schema/builtin_types.rb
|
|
986
961
|
- lib/lutaml/xml/schema/relaxng_schema.rb
|
|
987
962
|
- lib/lutaml/xml/schema/vc_namespace.rb
|
|
@@ -2047,7 +2022,6 @@ files:
|
|
|
2047
2022
|
- spec/lutaml/model/attribute_spec.rb
|
|
2048
2023
|
- spec/lutaml/model/attributes_memo_clear_race_spec.rb
|
|
2049
2024
|
- spec/lutaml/model/binary_attribute_value_spec.rb
|
|
2050
|
-
- spec/lutaml/model/boot_manifest_spec.rb
|
|
2051
2025
|
- spec/lutaml/model/cached_type_resolver_spec.rb
|
|
2052
2026
|
- spec/lutaml/model/cardinality_strict_spec.rb
|
|
2053
2027
|
- spec/lutaml/model/cast_element_form_spec.rb
|
|
@@ -2139,7 +2113,6 @@ files:
|
|
|
2139
2113
|
- spec/lutaml/model/namespace_autoload_spec.rb
|
|
2140
2114
|
- spec/lutaml/model/namespace_versioning_spec.rb
|
|
2141
2115
|
- spec/lutaml/model/one_entry_cache_spec.rb
|
|
2142
|
-
- spec/lutaml/model/opal_smoke_spec.rb
|
|
2143
2116
|
- spec/lutaml/model/optimization_spec.rb
|
|
2144
2117
|
- spec/lutaml/model/ordered_content_spec.rb
|
|
2145
2118
|
- spec/lutaml/model/parse_dispatch_hoist_spec.rb
|
|
@@ -2179,7 +2152,6 @@ files:
|
|
|
2179
2152
|
- spec/lutaml/model/serializable_spec.rb
|
|
2180
2153
|
- spec/lutaml/model/serializable_validation_spec.rb
|
|
2181
2154
|
- spec/lutaml/model/serialization_profiles_spec.rb
|
|
2182
|
-
- spec/lutaml/model/serialize/attribute_definition_block_form_spec.rb
|
|
2183
2155
|
- spec/lutaml/model/serialize/builder_spec.rb
|
|
2184
2156
|
- spec/lutaml/model/serialize_perf_guard_spec.rb
|
|
2185
2157
|
- spec/lutaml/model/services/transformer_spec.rb
|
|
@@ -2285,7 +2257,6 @@ files:
|
|
|
2285
2257
|
- spec/lutaml/xml/adapter/empty_document_diagnostics_spec.rb
|
|
2286
2258
|
- spec/lutaml/xml/adapter/moxml_lane_spec.rb
|
|
2287
2259
|
- spec/lutaml/xml/adapter/nokogiri_adapter_spec.rb
|
|
2288
|
-
- spec/lutaml/xml/adapter/oga_adapter_spec.rb
|
|
2289
2260
|
- spec/lutaml/xml/adapter/order_spec.rb
|
|
2290
2261
|
- spec/lutaml/xml/adapter/over_cap_parse_spec.rb
|
|
2291
2262
|
- spec/lutaml/xml/adapter/ox_adapter_spec.rb
|
|
@@ -2371,7 +2342,6 @@ files:
|
|
|
2371
2342
|
- spec/lutaml/xml/namespace_three_phase_spec.rb
|
|
2372
2343
|
- spec/lutaml/xml/nil_optional_element_namespace_spec.rb
|
|
2373
2344
|
- spec/lutaml/xml/ooxml_namespace_spec.rb
|
|
2374
|
-
- spec/lutaml/xml/opal_xml_spec.rb
|
|
2375
2345
|
- spec/lutaml/xml/ordered_method_spec.rb
|
|
2376
2346
|
- spec/lutaml/xml/out_of_namespace_parsing_spec.rb
|
|
2377
2347
|
- spec/lutaml/xml/parse_dom_retention_spec.rb
|
|
@@ -2467,7 +2437,6 @@ files:
|
|
|
2467
2437
|
- spec/person_spec.rb
|
|
2468
2438
|
- spec/sample_model_spec.rb
|
|
2469
2439
|
- spec/spec_helper.rb
|
|
2470
|
-
- spec/support/opal.rb
|
|
2471
2440
|
- spec/support/test_adapter_config.rb
|
|
2472
2441
|
- spec/support/test_namespaces.rb
|
|
2473
2442
|
- spec/support/trace_helper.rb
|
|
@@ -1,106 +0,0 @@
|
|
|
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
|
-
concurrency:
|
|
35
|
-
group: js-pr-check-${{ github.ref }}
|
|
36
|
-
cancel-in-progress: true
|
|
37
|
-
|
|
38
|
-
jobs:
|
|
39
|
-
trigger:
|
|
40
|
-
runs-on: ubuntu-latest
|
|
41
|
-
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == 'lutaml/lutaml-model' }}
|
|
42
|
-
steps:
|
|
43
|
-
- uses: actions/checkout@v6
|
|
44
|
-
with:
|
|
45
|
-
# Need the PR head, not the merge commit, so the SHA the JS
|
|
46
|
-
# build pulls matches what reviewers see.
|
|
47
|
-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
48
|
-
fetch-depth: 0
|
|
49
|
-
|
|
50
|
-
- name: Resolve PR inputs
|
|
51
|
-
id: pr
|
|
52
|
-
uses: actions/github-script@v7
|
|
53
|
-
with:
|
|
54
|
-
script: |
|
|
55
|
-
const prNumber = context.payload.inputs?.pr_number
|
|
56
|
-
? parseInt(context.payload.inputs.pr_number, 10)
|
|
57
|
-
: context.payload.pull_request?.number;
|
|
58
|
-
if (!prNumber) {
|
|
59
|
-
core.setFailed("No PR number available");
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const { data: pr } = await github.rest.pulls.get({
|
|
63
|
-
owner: context.repo.owner,
|
|
64
|
-
repo: context.repo.repo,
|
|
65
|
-
pull_number: prNumber,
|
|
66
|
-
});
|
|
67
|
-
core.setOutput("number", String(prNumber));
|
|
68
|
-
core.setOutput("sha", pr.head.sha);
|
|
69
|
-
core.setOutput("ref", pr.head.ref);
|
|
70
|
-
core.setOutput("repo", pr.head.repo.full_name);
|
|
71
|
-
|
|
72
|
-
- name: Notify lutaml-model-js
|
|
73
|
-
uses: peter-evans/repository-dispatch@v3
|
|
74
|
-
with:
|
|
75
|
-
token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
|
|
76
|
-
repository: lutaml/lutaml-model-js
|
|
77
|
-
event-type: js-pr-check
|
|
78
|
-
client-payload: |-
|
|
79
|
-
{
|
|
80
|
-
"pr_number": ${{ steps.pr.outputs.number }},
|
|
81
|
-
"sha": "${{ steps.pr.outputs.sha }}",
|
|
82
|
-
"ref": "${{ steps.pr.outputs.ref }}",
|
|
83
|
-
"repo": "${{ steps.pr.outputs.repo }}"
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
- name: Annotate PR with build link
|
|
87
|
-
if: ${{ github.event_name == 'pull_request' }}
|
|
88
|
-
uses: actions/github-script@v7
|
|
89
|
-
with:
|
|
90
|
-
script: |
|
|
91
|
-
const body = [
|
|
92
|
-
"### JS build check",
|
|
93
|
-
"",
|
|
94
|
-
"Triggered [`js-pr-check`]",
|
|
95
|
-
`(https://github.com/lutaml/lutaml-model-js/actions/workflows/pr-check.yml)`,
|
|
96
|
-
"against this PR's head (`" + context.payload.pull_request.head.sha.substring(0, 7) + "`).",
|
|
97
|
-
"",
|
|
98
|
-
"The result will appear as a `lutaml-model-js / pr-check` status check",
|
|
99
|
-
"on this PR once the workflow run completes.",
|
|
100
|
-
].join("\n");
|
|
101
|
-
await github.rest.issues.createComment({
|
|
102
|
-
owner: context.repo.owner,
|
|
103
|
-
repo: context.repo.repo,
|
|
104
|
-
issue_number: context.payload.pull_request.number,
|
|
105
|
-
body,
|
|
106
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
concurrency:
|
|
24
|
-
group: js-sync-${{ github.ref }}
|
|
25
|
-
cancel-in-progress: true
|
|
26
|
-
|
|
27
|
-
jobs:
|
|
28
|
-
trigger:
|
|
29
|
-
runs-on: ubuntu-latest
|
|
30
|
-
steps:
|
|
31
|
-
- uses: actions/checkout@v6
|
|
32
|
-
with:
|
|
33
|
-
fetch-depth: 0
|
|
34
|
-
|
|
35
|
-
- name: Resolve SHA
|
|
36
|
-
id: sha
|
|
37
|
-
run: |
|
|
38
|
-
if [ -n "${{ github.event.inputs.sha }}" ]; then
|
|
39
|
-
echo "sha=${{ github.event.inputs.sha }}" >> "$GITHUB_OUTPUT"
|
|
40
|
-
else
|
|
41
|
-
echo "sha=${{ github.sha }}" >> "$GITHUB_OUTPUT"
|
|
42
|
-
fi
|
|
43
|
-
|
|
44
|
-
- name: Notify lutaml-model-js
|
|
45
|
-
uses: peter-evans/repository-dispatch@v3
|
|
46
|
-
with:
|
|
47
|
-
token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
|
|
48
|
-
repository: lutaml/lutaml-model-js
|
|
49
|
-
event-type: js-sync-main
|
|
50
|
-
client-payload: |-
|
|
51
|
-
{
|
|
52
|
-
"sha": "${{ steps.sha.outputs.sha }}",
|
|
53
|
-
"ref": "${{ github.ref }}",
|
|
54
|
-
"ruby_ref": "main"
|
|
55
|
-
}
|
data/.github/workflows/opal.yml
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# DEPRECATED: the Opal lane is on the deprecation path (the moxml-ts
|
|
2
|
-
# wasm binding is the JavaScript endgame). The lane stays green — the
|
|
3
|
-
# boot repair chain lives in lib/compat/opal — but it is
|
|
4
|
-
# maintenance-only and non-gating; removal is planned for a future
|
|
5
|
-
# release.
|
|
6
|
-
name: opal
|
|
7
|
-
|
|
8
|
-
on:
|
|
9
|
-
push:
|
|
10
|
-
branches: [main]
|
|
11
|
-
tags: [ v* ]
|
|
12
|
-
pull_request:
|
|
13
|
-
|
|
14
|
-
permissions:
|
|
15
|
-
contents: read
|
|
16
|
-
|
|
17
|
-
concurrency:
|
|
18
|
-
group: opal-${{ github.ref }}
|
|
19
|
-
cancel-in-progress: true
|
|
20
|
-
|
|
21
|
-
jobs:
|
|
22
|
-
test:
|
|
23
|
-
runs-on: ubuntu-latest
|
|
24
|
-
env:
|
|
25
|
-
# The Opal leg is the ONLY consumer of the vendored
|
|
26
|
-
# Opal-compatibility forks (#835 step 2): MRI legs run released
|
|
27
|
-
# oga/ruby-ll.
|
|
28
|
-
LUTAML_OPAL_FORKS: "1"
|
|
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: "3.4"
|
|
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: Set up Node.js
|
|
44
|
-
uses: actions/setup-node@v4
|
|
45
|
-
with:
|
|
46
|
-
node-version: "18"
|
|
47
|
-
|
|
48
|
-
- name: Install ragel
|
|
49
|
-
run: sudo apt-get update && sudo apt-get install -y ragel
|
|
50
|
-
|
|
51
|
-
- name: Install ruby-ll (for rake vendor:prepare)
|
|
52
|
-
run: gem install ruby-ll --no-document
|
|
53
|
-
|
|
54
|
-
- name: Generate ragel / ruby-ll outputs in vendored forks
|
|
55
|
-
# Run before bundle install: the path-source oga/ruby-ll forks
|
|
56
|
-
# gitignore their generated .rb/.c files. bundle install compiles
|
|
57
|
-
# the C extensions via each fork's extconf.rb, which needs
|
|
58
|
-
# ext/c/lexer.c to exist.
|
|
59
|
-
run: rake vendor:prepare
|
|
60
|
-
|
|
61
|
-
- name: Install dependencies
|
|
62
|
-
run: bundle install
|
|
63
|
-
|
|
64
|
-
- name: Run Opal tests
|
|
65
|
-
run: bundle exec rake spec:opal
|
data/.gitmodules
DELETED
data/.rspec-opal
DELETED
data/docs/_guides/opal.adoc
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Opal Usage Guide
|
|
3
|
-
parent: Guides
|
|
4
|
-
nav_order: 99
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
= Opal Usage Guide
|
|
8
|
-
|
|
9
|
-
:toc:
|
|
10
|
-
:toclevels: 3
|
|
11
|
-
|
|
12
|
-
== Overview
|
|
13
|
-
|
|
14
|
-
[IMPORTANT]
|
|
15
|
-
====
|
|
16
|
-
Opal support in lutaml-model is **deprecated**. The Opal boot lane, its
|
|
17
|
-
compat shims, and the vendored Opal forks remain functional in the 0.8
|
|
18
|
-
line but receive maintenance-only attention, and removal is planned for
|
|
19
|
-
a future release. New JavaScript-targeted work is directed at the
|
|
20
|
-
moxml-ts wasm binding instead.
|
|
21
|
-
====
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
https://opalrb.com[Opal] is a Ruby-to-JavaScript compiler that allows Ruby code to run in the browser. Lutaml::Model supports running under Opal, enabling XML/JSON/YAML serialization in client-side applications.
|
|
26
|
-
|
|
27
|
-
The XML parsing layer is provided by the https://github.com/lutaml/moxml[moxml] gem (v0.2+), which detects the Opal runtime and uses the REXML adapter automatically.
|
|
28
|
-
|
|
29
|
-
== How it works
|
|
30
|
-
|
|
31
|
-
Opal compiles Ruby source code to JavaScript. Under Opal:
|
|
32
|
-
|
|
33
|
-
. `RUBY_ENGINE` equals `"opal"`
|
|
34
|
-
. `Lutaml::Model::RuntimeCompatibility.opal?` returns `true`
|
|
35
|
-
. Adapter selection is adjusted automatically
|
|
36
|
-
. Gems with C extensions (Nokogiri, Ox, Oj, tomlib) are not available
|
|
37
|
-
. REXML is used for XML because Opal reimplements `strscan` and `stringio` in its stdlib, enabling REXML (pure Ruby) to compile cleanly to JavaScript
|
|
38
|
-
|
|
39
|
-
No configuration is needed -- the runtime is detected and adapters are selected automatically.
|
|
40
|
-
|
|
41
|
-
== Supported features
|
|
42
|
-
|
|
43
|
-
=== Fully supported
|
|
44
|
-
|
|
45
|
-
* Model definition with `attribute`, types, collections, defaults
|
|
46
|
-
* XML serialization/deserialization (via REXML adapter)
|
|
47
|
-
** Element and attribute mapping
|
|
48
|
-
** Nested elements and collections
|
|
49
|
-
** Mixed content
|
|
50
|
-
** Namespaces (parsing and serialization)
|
|
51
|
-
** CDATA sections
|
|
52
|
-
** Processing instructions
|
|
53
|
-
** Comments
|
|
54
|
-
** Entity references
|
|
55
|
-
** XML declarations and doctypes
|
|
56
|
-
* JSON serialization/deserialization (via standard adapter)
|
|
57
|
-
* YAML serialization/deserialization (via standard adapter)
|
|
58
|
-
* Hash transformation
|
|
59
|
-
* Custom types
|
|
60
|
-
* Model import (`import_model`)
|
|
61
|
-
* Value transformations
|
|
62
|
-
|
|
63
|
-
=== Not available
|
|
64
|
-
|
|
65
|
-
[cols="1,3",options="header"]
|
|
66
|
-
|===
|
|
67
|
-
| Feature | Reason
|
|
68
|
-
| XSD schema generation | Requires Nokogiri
|
|
69
|
-
| RELAX NG generation | Requires Nokogiri
|
|
70
|
-
| XML schema compilation | Requires Nokogiri + native parsing
|
|
71
|
-
| TOML serialization | Both tomlib and toml-rb require native extensions
|
|
72
|
-
| Oj / MultiJson adapters | Require native extensions
|
|
73
|
-
| Ox / Nokogiri / Oga adapters | Require native extensions or C extensions
|
|
74
|
-
| XPath queries | REXML XPath requires features not yet in Opal's stdlib
|
|
75
|
-
| Liquid templating | Uses file-system-based template loading (Phase 1: skipped)
|
|
76
|
-
| Canon XML equivalence | Uses Nokogiri for XML parsing
|
|
77
|
-
|===
|
|
78
|
-
|
|
79
|
-
== Setup
|
|
80
|
-
|
|
81
|
-
=== Gemfile
|
|
82
|
-
|
|
83
|
-
Add Opal gems to your Gemfile:
|
|
84
|
-
|
|
85
|
-
[source,ruby]
|
|
86
|
-
----
|
|
87
|
-
gem "lutaml-model"
|
|
88
|
-
|
|
89
|
-
group :opal do
|
|
90
|
-
gem "opal", "~> 1.8"
|
|
91
|
-
gem "opal-rspec", "~> 1.0"
|
|
92
|
-
gem "opal-sprockets"
|
|
93
|
-
end
|
|
94
|
-
----
|
|
95
|
-
|
|
96
|
-
=== Rake task
|
|
97
|
-
|
|
98
|
-
Add an Opal RSpec task to your Rakefile:
|
|
99
|
-
|
|
100
|
-
[source,ruby]
|
|
101
|
-
----
|
|
102
|
-
begin
|
|
103
|
-
require "opal/rspec/rake_task"
|
|
104
|
-
rescue LoadError
|
|
105
|
-
# Opal not available
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
namespace :spec do
|
|
109
|
-
if defined?(Opal::RSpec::RakeTask)
|
|
110
|
-
desc "Run Opal (JavaScript) tests"
|
|
111
|
-
Opal::RSpec::RakeTask.new(:opal) do |server, runner|
|
|
112
|
-
server.append_path "lib"
|
|
113
|
-
runner.default_path = "spec"
|
|
114
|
-
runner.pattern = "spec/**/*_spec.{rb,opal}"
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
----
|
|
119
|
-
|
|
120
|
-
=== Test configuration
|
|
121
|
-
|
|
122
|
-
Create `spec/support/opal.rb` for Opal-specific test patches:
|
|
123
|
-
|
|
124
|
-
[source,ruby]
|
|
125
|
-
----
|
|
126
|
-
# frozen_string_literal: true
|
|
127
|
-
|
|
128
|
-
if RUBY_ENGINE == "opal"
|
|
129
|
-
Lutaml::Model::Config.xml_adapter_type = :rexml
|
|
130
|
-
end
|
|
131
|
-
----
|
|
132
|
-
|
|
133
|
-
Create `.rspec-opal`:
|
|
134
|
-
|
|
135
|
-
----
|
|
136
|
-
--default-path=spec
|
|
137
|
-
--pattern='spec/**/*_spec.{rb,opal}'
|
|
138
|
-
-I lib
|
|
139
|
-
--opal-opt=-g,lutaml-model
|
|
140
|
-
-I spec
|
|
141
|
-
--require=spec_helper
|
|
142
|
-
--require=support/opal
|
|
143
|
-
----
|
|
144
|
-
|
|
145
|
-
=== CI workflow
|
|
146
|
-
|
|
147
|
-
Add `.github/workflows/opal.yml`:
|
|
148
|
-
|
|
149
|
-
[source,yaml]
|
|
150
|
-
----
|
|
151
|
-
name: opal
|
|
152
|
-
on:
|
|
153
|
-
push:
|
|
154
|
-
branches: [main]
|
|
155
|
-
pull_request:
|
|
156
|
-
|
|
157
|
-
jobs:
|
|
158
|
-
test:
|
|
159
|
-
runs-on: ubuntu-latest
|
|
160
|
-
steps:
|
|
161
|
-
- uses: actions/checkout@v4
|
|
162
|
-
with:
|
|
163
|
-
submodules: "recursive"
|
|
164
|
-
- uses: ruby/setup-ruby@v1
|
|
165
|
-
with:
|
|
166
|
-
ruby-version: "3.3"
|
|
167
|
-
bundler-cache: true
|
|
168
|
-
- uses: actions/setup-node@v4
|
|
169
|
-
with:
|
|
170
|
-
node-version: "18"
|
|
171
|
-
- name: Run Opal tests
|
|
172
|
-
run: bundle exec rake spec:opal
|
|
173
|
-
----
|
|
174
|
-
|
|
175
|
-
== Example: XML round-trip in the browser
|
|
176
|
-
|
|
177
|
-
[source,ruby]
|
|
178
|
-
----
|
|
179
|
-
class Person
|
|
180
|
-
include Lutaml::Model::Serialize
|
|
181
|
-
|
|
182
|
-
attribute :name, :string
|
|
183
|
-
attribute :age, :integer
|
|
184
|
-
|
|
185
|
-
xml do
|
|
186
|
-
element "person"
|
|
187
|
-
map_element "name", to: :name
|
|
188
|
-
map_element "age", to: :age
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
# Parse XML
|
|
193
|
-
person = Person.from_xml('<person><name>Alice</name><age>30</age></person>')
|
|
194
|
-
person.name # => "Alice"
|
|
195
|
-
person.age # => 30
|
|
196
|
-
|
|
197
|
-
# Serialize to XML
|
|
198
|
-
person.to_xml # => "<person><name>Alice</name><age>30</age></person>"
|
|
199
|
-
|
|
200
|
-
# JSON and YAML also work
|
|
201
|
-
person.to_json # => '{"name":"Alice","age":30}'
|
|
202
|
-
person.to_yaml # => "---\nname: Alice\nage: 30\n"
|
|
203
|
-
----
|
|
204
|
-
|
|
205
|
-
== Architecture
|
|
206
|
-
|
|
207
|
-
Under Opal, the library uses a JRuby-like pattern for dependency management:
|
|
208
|
-
|
|
209
|
-
. *Dependencies stay in the gemspec.* Gems like Nokogiri, Ox, and Oga remain listed as dependencies -- they are simply not loadable under Opal.
|
|
210
|
-
. *Requires are guarded with `RUBY_ENGINE`.* Code that depends on native gems uses `RUBY_ENGINE == "opal"` checks instead of silent `rescue LoadError`.
|
|
211
|
-
. *No gem splitting.* The same gem works on both MRI and Opal.
|
|
212
|
-
|
|
213
|
-
Key components:
|
|
214
|
-
* `Lutaml::Model::RuntimeCompatibility` -- detects the runtime (opal, windows, native)
|
|
215
|
-
* `Lutaml::Model::AdapterResolver` -- selects adapters based on runtime capabilities
|
|
216
|
-
* `Moxml::Config::OPAL_DEFAULT_ADAPTER` -- set to `:rexml`
|
|
217
|
-
* `Moxml::Adapter::OPAL_AVAILABLE_ADAPTERS` -- set to `%i[rexml]`
|
|
218
|
-
|
|
219
|
-
== Dependencies
|
|
220
|
-
|
|
221
|
-
The following gems in the lutaml ecosystem support Opal:
|
|
222
|
-
|
|
223
|
-
* **lutaml-model** -- Core model library (this gem)
|
|
224
|
-
* **moxml** (v0.2+) -- XML parsing abstraction with REXML adapter for Opal
|
|
225
|
-
* **canon** -- XML comparison (uses moxml under Opal; comparison features work but Nokogiri-specific features do not)
|
|
226
|
-
|
|
227
|
-
== Limitations
|
|
228
|
-
|
|
229
|
-
* **No XPath** -- REXML's XPath module has dependencies not yet reimplemented in Opal's stdlib.
|
|
230
|
-
* **No schema generation** -- XSD, RELAX NG generation, and schema compilation require Nokogiri.
|
|
231
|
-
* **No TOML** -- Both TOML adapters (tomlib, toml-rb) require native extensions.
|
|
232
|
-
* **No Liquid** -- Template rendering via Liquid is skipped in Opal (file-system dependency). May be addressed in a future phase using liquidjs via Opal's JavaScript bridge.
|