lutaml-model 0.8.17 → 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.
- checksums.yaml +4 -4
- data/.github/workflows/downstream-performance.yml +27 -1
- data/.github/workflows/js-pr-check.yml +102 -0
- data/.github/workflows/js-sync.yml +51 -0
- data/.github/workflows/opal.yml +26 -6
- data/.github/workflows/performance.yml +32 -7
- data/.github/workflows/rake.yml +78 -32
- data/.gitmodules +6 -0
- data/.rubocop_todo.yml +8 -0
- data/Gemfile +16 -1
- data/README.adoc +267 -0
- data/Rakefile +166 -4
- data/docs/_guides/schema-import.adoc +42 -0
- data/docs/_guides/xml-mapping.adoc +21 -0
- data/docs/_pages/validation.adoc +65 -0
- data/lib/compat/opal/generate_boot.rb +123 -0
- data/lib/compat/opal/js_bundle_entry.rb +42 -0
- data/lib/compat/opal/lutaml_model_boot.rb +497 -0
- data/lib/compat/opal/moxml_boot.rb +68 -0
- data/lib/compat/opal/yaml_compat.rb +32 -0
- data/lib/lutaml/json.rb +1 -1
- data/lib/lutaml/key_value/transform.rb +3 -8
- data/lib/lutaml/key_value/transformation/value_serializer.rb +14 -1
- data/lib/lutaml/key_value/transformation.rb +17 -5
- data/lib/lutaml/model/adapter_resolver.rb +2 -2
- data/lib/lutaml/model/attribute.rb +88 -11
- data/lib/lutaml/model/cached_type_resolver.rb +1 -1
- data/lib/lutaml/model/error/union_schema_unsupported_error.rb +11 -0
- data/lib/lutaml/model/global_context.rb +11 -8
- data/lib/lutaml/model/instrumentation.rb +2 -2
- data/lib/lutaml/model/mapping/mapping_rule.rb +0 -6
- data/lib/lutaml/model/register.rb +2 -2
- data/lib/lutaml/model/runtime_compatibility.rb +50 -0
- data/lib/lutaml/model/schema/class_loader.rb +58 -0
- data/lib/lutaml/model/schema/compiled_output.rb +83 -0
- data/lib/lutaml/model/schema/definitions/attribute.rb +32 -0
- data/lib/lutaml/model/schema/definitions/choice.rb +20 -0
- data/lib/lutaml/model/schema/definitions/facet.rb +40 -0
- data/lib/lutaml/model/schema/definitions/group_import.rb +22 -0
- data/lib/lutaml/model/schema/definitions/member_walk.rb +33 -0
- data/lib/lutaml/model/schema/definitions/model.rb +40 -0
- data/lib/lutaml/model/schema/definitions/namespace.rb +23 -0
- data/lib/lutaml/model/schema/definitions/restricted_type.rb +30 -0
- data/lib/lutaml/model/schema/definitions/sequence.rb +19 -0
- data/lib/lutaml/model/schema/definitions/simple_content.rb +22 -0
- data/lib/lutaml/model/schema/definitions/transform_facet.rb +21 -0
- data/lib/lutaml/model/schema/definitions/type_ref.rb +20 -0
- data/lib/lutaml/model/schema/definitions/union_type.rb +28 -0
- data/lib/lutaml/model/schema/definitions/xml_root.rb +20 -0
- data/lib/lutaml/model/schema/definitions.rb +24 -0
- data/lib/lutaml/model/schema/file_writer.rb +70 -0
- data/lib/lutaml/model/schema/generator/definitions_collection.rb +16 -2
- data/lib/lutaml/model/schema/generator/property.rb +21 -4
- data/lib/lutaml/model/schema/module_nesting.rb +31 -0
- data/lib/lutaml/model/schema/namespace_naming.rb +46 -0
- data/lib/lutaml/model/schema/registry_generator.rb +115 -0
- data/lib/lutaml/model/schema/renderers/base.rb +40 -0
- data/lib/lutaml/model/schema/renderers/mappings.rb +72 -0
- data/lib/lutaml/model/schema/renderers/member_decls.rb +115 -0
- data/lib/lutaml/model/schema/renderers/model.rb +121 -0
- data/lib/lutaml/model/schema/renderers/namespace.rb +30 -0
- data/lib/lutaml/model/schema/renderers/registration.rb +64 -0
- data/lib/lutaml/model/schema/renderers/required_files_calculator.rb +93 -0
- data/lib/lutaml/model/schema/renderers/restricted_type.rb +88 -0
- data/lib/lutaml/model/schema/renderers/union.rb +83 -0
- data/lib/lutaml/model/schema/renderers.rb +19 -0
- data/lib/lutaml/model/schema/rnc_compiler/source_resolver.rb +47 -0
- data/lib/lutaml/model/schema/rnc_compiler.rb +62 -0
- data/lib/lutaml/model/schema/rng_compiler/define_classifier.rb +91 -0
- data/lib/lutaml/model/schema/rng_compiler/element_visitor.rb +392 -0
- data/lib/lutaml/model/schema/rng_compiler/member_collector.rb +30 -0
- data/lib/lutaml/model/schema/rng_compiler/rng_helpers.rb +152 -0
- data/lib/lutaml/model/schema/rng_compiler/value_type_resolver.rb +125 -0
- data/lib/lutaml/model/schema/rng_compiler.rb +220 -0
- data/lib/lutaml/model/schema/templates.rb +162 -0
- data/lib/lutaml/model/schema/xml_compiler/element_order.rb +41 -0
- data/lib/lutaml/model/schema/xml_compiler/registry_generator.rb +31 -107
- data/lib/lutaml/model/schema/xml_compiler/spec_builder/complex_types.rb +191 -0
- data/lib/lutaml/model/schema/xml_compiler/spec_builder/members.rb +216 -0
- data/lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb +153 -0
- data/lib/lutaml/model/schema/xml_compiler/spec_builder.rb +167 -0
- data/lib/lutaml/model/schema/xml_compiler/supported_data_types.rb +87 -0
- data/lib/lutaml/model/schema/xml_compiler.rb +38 -517
- data/lib/lutaml/model/schema.rb +19 -0
- data/lib/lutaml/model/serialize/attribute_definition.rb +14 -2
- data/lib/lutaml/model/serialize/builder.rb +15 -2
- data/lib/lutaml/model/serialize/value_mapping.rb +9 -57
- data/lib/lutaml/model/serialize.rb +6 -9
- data/lib/lutaml/model/services/rule_value_extractor.rb +2 -3
- data/lib/lutaml/model/services.rb +0 -2
- data/lib/lutaml/model/store.rb +2 -1
- data/lib/lutaml/model/toml.rb +1 -1
- data/lib/lutaml/model/transform.rb +17 -39
- data/lib/lutaml/model/transformation_registry.rb +1 -1
- data/lib/lutaml/model/type.rb +1 -0
- data/lib/lutaml/model/union.rb +320 -0
- data/lib/lutaml/model/utils.rb +6 -0
- data/lib/lutaml/model/validation.rb +1 -4
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/model.rb +18 -0
- data/lib/lutaml/toml.rb +1 -1
- data/lib/lutaml/xml/adapter.rb +1 -1
- data/lib/lutaml/xml/adapter_loader.rb +1 -1
- data/lib/lutaml/xml/builder/base.rb +1 -1
- data/lib/lutaml/xml/builder.rb +1 -1
- data/lib/lutaml/xml/error/schema_validation_error.rb +25 -0
- data/lib/lutaml/xml/model_transform.rb +5 -1
- data/lib/lutaml/xml/schema/relaxng_schema.rb +5 -0
- data/lib/lutaml/xml/schema/xsd_schema.rb +4 -0
- data/lib/lutaml/xml/serialization/format_conversion.rb +48 -0
- data/lib/lutaml/xml/serialization/instance_methods.rb +13 -0
- data/lib/lutaml/xml/transformation/element_builder.rb +21 -8
- data/lib/lutaml/xml/transformation/ordered_applier.rb +6 -0
- data/lib/lutaml/xml/xsd_validator.rb +66 -0
- data/lib/lutaml/xml.rb +53 -12
- data/lutaml-model.gemspec +4 -2
- data/spec/fixtures/xml/schema/rnc/address_book.rnc +15 -0
- data/spec/fixtures/xml/schema/rnc/book_features.rnc +18 -0
- data/spec/fixtures/xml/schema/rnc/includes/book.rnc +6 -0
- data/spec/fixtures/xml/schema/rnc/includes/circular_a.rnc +8 -0
- data/spec/fixtures/xml/schema/rnc/includes/circular_b.rnc +8 -0
- data/spec/fixtures/xml/schema/rnc/includes/library.rnc +8 -0
- data/spec/fixtures/xml/schema/rng/address_book.rng +16 -0
- data/spec/fixtures/xml/schema/rng/book.rng +27 -0
- data/spec/fixtures/xml/schema/rng/fixed_value.rng +11 -0
- data/spec/fixtures/xml/schema/rng/fragment_in_choice.rng +30 -0
- data/spec/fixtures/xml/schema/rng/full_name.rng +39 -0
- data/spec/fixtures/xml/schema/rng/integer_range.rng +32 -0
- data/spec/fixtures/xml/schema/rng/list_type.rng +12 -0
- data/spec/fixtures/xml/schema/rng/namespaced.rng +9 -0
- data/spec/fixtures/xml/schema/rng/paragraph.rng +13 -0
- data/spec/fixtures/xml/schema/rng/person.rng +23 -0
- data/spec/fixtures/xml/schema/rng/union.rng +14 -0
- data/spec/fixtures/xml/validate_xml_with_address.xsd +13 -0
- data/spec/fixtures/xml/validate_xml_with_contact.xsd +11 -0
- data/spec/fixtures/xml/validate_xml_with_person.xsd +11 -0
- data/spec/fixtures/xml/validate_xml_with_person_strict.xsd +17 -0
- data/spec/fixtures/xml/validate_xml_with_product.xsd +37 -0
- data/spec/lutaml/model/attribute_apply_value_map_spec.rb +134 -0
- data/spec/lutaml/model/attribute_spec.rb +169 -12
- data/spec/lutaml/model/boot_manifest_spec.rb +30 -0
- data/spec/lutaml/model/collection_spec.rb +18 -0
- data/spec/lutaml/model/mixed_content_spec.rb +171 -0
- data/spec/lutaml/model/opal_smoke_spec.rb +67 -2
- data/spec/lutaml/model/ordered_content_spec.rb +30 -0
- data/spec/lutaml/model/raw_element_spec.rb +125 -0
- data/spec/lutaml/model/rule_value_extractor_spec.rb +7 -14
- data/spec/lutaml/model/runtime_compatibility_spec.rb +25 -0
- data/spec/lutaml/model/schema/renderers/model_spec.rb +149 -0
- data/spec/lutaml/model/schema/renderers/namespace_spec.rb +36 -0
- data/spec/lutaml/model/schema/renderers/restricted_type_spec.rb +75 -0
- data/spec/lutaml/model/schema/renderers/union_spec.rb +58 -0
- data/spec/lutaml/model/transform_apply_value_map_spec.rb +64 -0
- data/spec/lutaml/model/union_attribute_spec.rb +658 -0
- data/spec/lutaml/model/union_spec.rb +257 -0
- data/spec/lutaml/model/utils_spec.rb +14 -0
- data/spec/lutaml/xml/opal_xml_spec.rb +22 -20
- data/spec/lutaml/xml/schema/compiler_spec.rb +21 -4
- data/spec/lutaml/xml/schema/rnc_compiler_spec.rb +404 -0
- data/spec/lutaml/xml/schema/rng_compiler_spec.rb +893 -0
- data/spec/lutaml/xml/validate_xml_with_constructs_spec.rb +222 -0
- data/spec/lutaml/xml/validate_xml_with_spec.rb +186 -0
- data/spec/spec_helper.rb +28 -11
- data/spec/support/opal.rb +5 -2
- metadata +97 -31
- data/lib/lutaml/model/schema/xml_compiler/attribute.rb +0 -106
- data/lib/lutaml/model/schema/xml_compiler/attribute_group.rb +0 -47
- data/lib/lutaml/model/schema/xml_compiler/choice.rb +0 -67
- data/lib/lutaml/model/schema/xml_compiler/complex_content.rb +0 -27
- data/lib/lutaml/model/schema/xml_compiler/complex_content_restriction.rb +0 -34
- data/lib/lutaml/model/schema/xml_compiler/complex_type.rb +0 -173
- data/lib/lutaml/model/schema/xml_compiler/element.rb +0 -121
- data/lib/lutaml/model/schema/xml_compiler/group.rb +0 -113
- data/lib/lutaml/model/schema/xml_compiler/restriction.rb +0 -104
- data/lib/lutaml/model/schema/xml_compiler/sequence.rb +0 -52
- data/lib/lutaml/model/schema/xml_compiler/simple_content.rb +0 -40
- data/lib/lutaml/model/schema/xml_compiler/simple_type.rb +0 -265
- data/lib/lutaml/model/schema/xml_compiler/xml_namespace_class.rb +0 -110
- data/lib/lutaml/model/services/default_value_resolver.rb +0 -60
- data/spec/lutaml/model/services/default_value_resolver_spec.rb +0 -162
- data/spec/lutaml/xml/schema/compiler/attribute_group_spec.rb +0 -71
- data/spec/lutaml/xml/schema/compiler/attribute_spec.rb +0 -67
- data/spec/lutaml/xml/schema/compiler/choice_spec.rb +0 -74
- data/spec/lutaml/xml/schema/compiler/complex_content_restriction_spec.rb +0 -60
- data/spec/lutaml/xml/schema/compiler/complex_content_spec.rb +0 -41
- data/spec/lutaml/xml/schema/compiler/complex_type_spec.rb +0 -202
- data/spec/lutaml/xml/schema/compiler/element_spec.rb +0 -68
- data/spec/lutaml/xml/schema/compiler/group_spec.rb +0 -90
- data/spec/lutaml/xml/schema/compiler/restriction_spec.rb +0 -77
- data/spec/lutaml/xml/schema/compiler/sequence_spec.rb +0 -65
- data/spec/lutaml/xml/schema/compiler/simple_content_spec.rb +0 -61
- 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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 852a93ce391ef7eb0f8e7673bda66f7bb417637b252735cebe833d1e305a6c7b
|
|
4
|
+
data.tar.gz: 65f067c3e0bf4e1d520d5e2d133a6de4606900844b5e91d367ce4edee51da0e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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:
|
|
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
|
+
}
|
data/.github/workflows/opal.yml
CHANGED
|
@@ -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@
|
|
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.
|
|
20
|
-
bundler-cache:
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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:
|
|
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
|
data/.github/workflows/rake.yml
CHANGED
|
@@ -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: [
|
|
5
|
+
branches: [ main ]
|
|
15
6
|
tags: [ v* ]
|
|
16
|
-
paths-ignore:
|
|
17
|
-
- '**.adoc'
|
|
18
|
-
- 'docs/**'
|
|
19
|
-
- '*.md'
|
|
20
|
-
- 'LICENSE'
|
|
21
7
|
pull_request:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
data/.gitmodules
ADDED
data/.rubocop_todo.yml
CHANGED
|
@@ -548,3 +548,11 @@ Style/StringConcatenation:
|
|
|
548
548
|
- 'lib/lutaml/model/schema/xml_compiler/complex_type.rb'
|
|
549
549
|
- 'lib/lutaml/model/schema/xml_compiler/simple_type.rb'
|
|
550
550
|
- 'lib/lutaml/model/schema/xml_compiler/xml_namespace_class.rb'
|
|
551
|
+
|
|
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:
|
|
557
|
+
Exclude:
|
|
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
|