lutaml-model 0.8.202 → 0.8.204
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/.gitattributes +5 -0
- data/.github/workflows/dependent-tests.yml +59 -2
- data/.github/workflows/lml-conformance.yml +71 -0
- data/.gitignore +7 -0
- data/README.adoc +1 -0
- data/docs/_guides/lml-cross-language.adoc +128 -0
- data/docs/_references/lml-conformance.adoc +78 -0
- data/docs/_references/lml-contract.adoc +290 -0
- data/docs/_references/plan-schema-spec.adoc +45 -18
- data/lib/lutaml/key_value/transform.rb +140 -21
- data/lib/lutaml/model/attribute.rb +11 -6
- data/lib/lutaml/model/lml/artifact_verifier.rb +205 -0
- data/lib/lutaml/model/lml/bundle.rb +171 -0
- data/lib/lutaml/model/lml/document.rb +46 -10
- data/lib/lutaml/model/lml/document_validator.rb +840 -0
- data/lib/lutaml/model/lml/exporter/v1_projector.rb +102 -0
- data/lib/lutaml/model/lml/exporter/v2_projector.rb +401 -0
- data/lib/lutaml/model/lml/exporter.rb +223 -87
- data/lib/lutaml/model/lml/graph_exporter.rb +248 -0
- data/lib/lutaml/model/lml/importer.rb +180 -0
- data/lib/lutaml/model/lml/mapping_compiler.rb +401 -0
- data/lib/lutaml/model/lml/materialization.rb +257 -0
- data/lib/lutaml/model/lml/ordered_content.rb +577 -0
- data/lib/lutaml/model/lml/portable_json.rb +385 -0
- data/lib/lutaml/model/lml/rejected_error.rb +64 -15
- data/lib/lutaml/model/lml/round_trip.rb +86 -0
- data/lib/lutaml/model/lml/value_declarations.rb +84 -0
- data/lib/lutaml/model/lml.rb +61 -0
- data/lib/lutaml/model/schema/definitions/attribute.rb +4 -2
- data/lib/lutaml/model/schema/registry_generator.rb +1 -1
- data/lib/lutaml/model/schema/renderers/member_decls.rb +1 -0
- data/lib/lutaml/model/schema/xml_compiler/spec_builder/members.rb +10 -0
- data/lib/lutaml/model/sequence.rb +7 -0
- data/lib/lutaml/model/serialize/deserialization_context.rb +21 -0
- data/lib/lutaml/model/serialize/initialization.rb +19 -9
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/xml/leptris/native_emission.rb +4 -0
- data/lib/lutaml/xml/leptris/plan_serializer.rb +14 -9
- data/schema/lml/document.schema.json +179 -0
- data/scripts/lml/export_choices.rb +57 -0
- data/scripts/lml/export_conformance.rb +23 -0
- data/scripts/lml/export_mml.rb +253 -0
- data/scripts/lml/export_preservation.rb +421 -0
- data/scripts/lml/verify_artifacts.rb +31 -0
- data/spec/address_person_spec.rb +8 -0
- data/spec/address_spec.rb +4 -0
- data/spec/fixtures/lml_artifacts/model.json +1 -0
- data/spec/fixtures/lml_artifacts/valid.json +1 -0
- data/spec/fixtures/lml_artifacts/valid.sha256 +1 -0
- data/spec/fixtures/lml_conformance/core/index.json +1 -0
- data/spec/fixtures/lml_conformance/core/manifest.json +1 -0
- data/spec/fixtures/lml_conformance/core/schema.json +1 -0
- data/spec/fixtures/lml_conformance/core/schema.yaml +79 -0
- data/spec/fixtures/lml_conformance/float_vectors.generator.rb +60 -0
- data/spec/fixtures/lml_conformance/float_vectors.json +21550 -0
- data/spec/fixtures/lml_conformance/preservation/index.json +1 -0
- data/spec/fixtures/lml_conformance/preservation/manifest.json +1 -0
- data/spec/fixtures/lml_conformance/preservation/schema.json +1 -0
- data/spec/fixtures/lml_conformance/preservation/schema.yaml +319 -0
- data/spec/fixtures/lml_conformance/r2_refusals.generator.rb +153 -0
- data/spec/fixtures/lml_conformance/r2_refusals.json +1662 -0
- data/spec/fixtures/lml_conformance/ruby_portable_interop.generator.rb +40 -0
- data/spec/fixtures/lml_conformance/ruby_portable_interop.json +1 -0
- data/spec/fixtures/lml_contract/bundle.json +81 -0
- data/spec/fixtures/lml_contract/manifest.json +30 -0
- data/spec/fixtures/lml_contract/v1_unit.canonical.json +1 -0
- data/spec/fixtures/lml_contract/v1_unit.json +1 -0
- data/spec/fixtures/lml_contract/v2_node.canonical.json +1 -0
- data/spec/fixtures/lml_contract/v2_node.json +32 -0
- data/spec/fixtures/lml_mml/inventory.json +1 -0
- data/spec/fixtures/lml_mml/manifest.json +1 -0
- data/spec/fixtures/lml_mml/oracle.json +1 -0
- data/spec/fixtures/lml_mml/v3-mi-mixed.json +1 -0
- data/spec/fixtures/lml_mml/v3-mi-mixed.yaml +970 -0
- data/spec/fixtures/lml_mml/v4-mi-mixed.json +1 -0
- data/spec/fixtures/lml_mml/v4-mi-mixed.yaml +1516 -0
- data/spec/fixtures/lml_mml_materialization/replay.rb +37 -0
- data/spec/lutaml/key_value/group_instantiate_spec.rb +204 -1
- data/spec/lutaml/model/lml_any_attribute_spec.rb +91 -0
- data/spec/lutaml/model/lml_artifact_verifier_spec.rb +86 -0
- data/spec/lutaml/model/lml_builtin_types_spec.rb +49 -0
- data/spec/lutaml/model/lml_conformance_spec.rb +178 -0
- data/spec/lutaml/model/lml_document_spec.rb +279 -0
- data/spec/lutaml/model/lml_export_validation_spec.rb +96 -0
- data/spec/lutaml/model/lml_exporter_spec.rb +127 -5
- data/spec/lutaml/model/lml_graph_exporter_spec.rb +205 -0
- data/spec/lutaml/model/lml_importer_spec.rb +290 -0
- data/spec/lutaml/model/lml_input_hardening_spec.rb +156 -0
- data/spec/lutaml/model/lml_mapping_compiler_spec.rb +256 -0
- data/spec/lutaml/model/lml_materialization_spec.rb +138 -0
- data/spec/lutaml/model/lml_mml_materialization_spec.rb +54 -0
- data/spec/lutaml/model/lml_mml_pilot_spec.rb +150 -0
- data/spec/lutaml/model/lml_model_choices_spec.rb +88 -0
- data/spec/lutaml/model/lml_ordered_content_spec.rb +243 -0
- data/spec/lutaml/model/lml_portable_json_spec.rb +310 -0
- data/spec/lutaml/model/lml_preservation_spec.rb +211 -0
- data/spec/lutaml/model/lml_review_export_spec.rb +247 -0
- data/spec/lutaml/model/lml_review_import_spec.rb +390 -0
- data/spec/lutaml/model/lml_review_misc_spec.rb +152 -0
- data/spec/lutaml/model/lml_review_round4_spec.rb +200 -0
- data/spec/lutaml/model/lml_review_round5_spec.rb +194 -0
- data/spec/lutaml/model/lml_ruby_interop_fixture_spec.rb +37 -0
- data/spec/lutaml/model/lml_shared_corpus_spec.rb +132 -0
- data/spec/lutaml/model/lml_value_declarations_spec.rb +128 -0
- data/spec/lutaml/model/schema/class_loader_spec.rb +51 -0
- data/spec/lutaml/model/schema/xml_compiler_runtime_spec.rb +20 -0
- data/spec/lutaml/model/sequence_spec.rb +48 -0
- data/spec/lutaml/model/serialize/deserialization_context_spec.rb +68 -0
- data/spec/lutaml/xml/cdata_emission_spec.rb +68 -0
- data/spec/spec_helper.rb +4 -5
- data/spec/support/lml_any_attribute_fixtures.rb +26 -0
- data/spec/support/lml_conformance.rb +292 -0
- data/spec/support/lml_corpus.rb +75 -0
- data/spec/support/lml_export_fixtures.rb +190 -0
- data/spec/support/lml_graph_fixtures.rb +108 -0
- data/spec/support/lml_import_fixtures.rb +52 -0
- data/spec/support/lml_mapping_fixtures.rb +170 -0
- data/spec/support/lml_materialization_fixtures.rb +53 -0
- data/spec/support/lml_model_choices_fixtures.rb +150 -0
- data/spec/support/lml_order_fixtures.rb +151 -0
- metadata +93 -2
- data/lib/lutaml/model/schema/schema_builder/nokogiri.rb +0 -41
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 230c2c513344d8665bb44607cefc80663100ac9707ee8ce63146e5b8ed6cbdbc
|
|
4
|
+
data.tar.gz: 2ac13fcbc47d3b7011c3957a6d988d3c996cf10fee05fe04040f82979b89d928
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d0a5e9ac99b9ef4f68b6eb629ade317097f72d6d54187b3521f7007ccdfda47a4c03d7143040fe86987072b992d7e4741ef62c8b1a683f310b5191c391489bc
|
|
7
|
+
data.tar.gz: a0300c85e81232f5a07151c12d69575d0d0caf38c2540268baffcffe57d7d8744802a89030be6fd597f0109f148eaa9fcceddfcee2cb90f04fcade9696cab5ac
|
data/.gitattributes
ADDED
|
@@ -47,6 +47,25 @@ jobs:
|
|
|
47
47
|
repos-json-file: .github/workflows/dependent-repos.json
|
|
48
48
|
matrix_ruby: '[{"version":"4.0","rubygems":"latest","bundler":"default","experimental":false}]'
|
|
49
49
|
matrix_os: ${{ github.event_name == 'pull_request' && '["ubuntu-latest","windows-latest"]' || '' }}
|
|
50
|
+
# metanorma/ci's tool-setup-action retired inkscape and ghostscript
|
|
51
|
+
# (2026-11-12) and ffmpeg (2026-11-26), so those setup-tools names
|
|
52
|
+
# are ignored and ukiryu's specs for them are skipped rather than
|
|
53
|
+
# run. Install them here, the way the retired actions did.
|
|
54
|
+
before-setup-ruby: |
|
|
55
|
+
case "$RUNNER_OS" in
|
|
56
|
+
Linux)
|
|
57
|
+
sudo apt-get update
|
|
58
|
+
sudo apt-get install -y --no-install-recommends inkscape ghostscript ffmpeg
|
|
59
|
+
;;
|
|
60
|
+
macOS)
|
|
61
|
+
export HOMEBREW_NO_AUTO_UPDATE=1
|
|
62
|
+
HOMEBREW_CASK_OPTS=--no-quarantine brew install --cask inkscape
|
|
63
|
+
brew install ghostscript ffmpeg
|
|
64
|
+
;;
|
|
65
|
+
Windows)
|
|
66
|
+
choco install --no-progress -y inkscape ghostscript ffmpeg
|
|
67
|
+
;;
|
|
68
|
+
esac
|
|
50
69
|
after-setup-ruby: |
|
|
51
70
|
if [ -f frontend/package.json ]; then cd frontend && npm install && npm run build; fi
|
|
52
71
|
secrets:
|
|
@@ -67,9 +86,28 @@ jobs:
|
|
|
67
86
|
# dependent log is attributable at a glance (#1225).
|
|
68
87
|
command: set +e; echo "spec-files=$(find spec -name '*_spec.rb' 2>/dev/null | wc -l)"; echo "lutaml-model-under-test:"; bundle info lutaml-model 2>/dev/null | sed -n '1,4p'; bundle exec rspec; code=$?; echo "rspec-exit=$code"; exit $code
|
|
69
88
|
repos-json-file: .github/workflows/dependent-repos-tools.json
|
|
70
|
-
setup-tools: '
|
|
89
|
+
setup-tools: 'exiftool,imagemagick,yq'
|
|
71
90
|
matrix_ruby: '[{"version":"4.0","rubygems":"latest","bundler":"default","experimental":false}]'
|
|
72
91
|
matrix_os: ${{ github.event_name == 'pull_request' && '["ubuntu-latest","windows-latest"]' || '' }}
|
|
92
|
+
# metanorma/ci's tool-setup-action retired inkscape and ghostscript
|
|
93
|
+
# (2026-11-12) and ffmpeg (2026-11-26), so those setup-tools names
|
|
94
|
+
# are ignored and ukiryu's specs for them are skipped rather than
|
|
95
|
+
# run. Install them here, the way the retired actions did.
|
|
96
|
+
before-setup-ruby: |
|
|
97
|
+
case "$RUNNER_OS" in
|
|
98
|
+
Linux)
|
|
99
|
+
sudo apt-get update
|
|
100
|
+
sudo apt-get install -y --no-install-recommends inkscape ghostscript ffmpeg
|
|
101
|
+
;;
|
|
102
|
+
macOS)
|
|
103
|
+
export HOMEBREW_NO_AUTO_UPDATE=1
|
|
104
|
+
HOMEBREW_CASK_OPTS=--no-quarantine brew install --cask inkscape
|
|
105
|
+
brew install ghostscript ffmpeg
|
|
106
|
+
;;
|
|
107
|
+
Windows)
|
|
108
|
+
choco install --no-progress -y inkscape ghostscript ffmpeg
|
|
109
|
+
;;
|
|
110
|
+
esac
|
|
73
111
|
after-setup-ruby: |
|
|
74
112
|
if [ -f frontend/package.json ]; then cd frontend && npm install && npm run build; fi
|
|
75
113
|
secrets:
|
|
@@ -86,9 +124,28 @@ jobs:
|
|
|
86
124
|
with:
|
|
87
125
|
command: set +e; echo "spec-files=$(find spec -name '*_spec.rb' 2>/dev/null | wc -l)"; echo "lutaml-model-under-test:"; bundle info lutaml-model 2>/dev/null | sed -n '1,4p'; bundle exec rspec > rspec-run.log 2>&1; code=$?; echo "informational rspec-exit=$code (non-blocking notice)"; tail -25 rspec-run.log; grep -B2 -A14 "Failure/Error" rspec-run.log | head -160; exit 0
|
|
88
126
|
repos-json-file: .github/workflows/dependent-repos-tools-informational.json
|
|
89
|
-
setup-tools: '
|
|
127
|
+
setup-tools: 'exiftool,imagemagick,yq'
|
|
90
128
|
matrix_ruby: '[{"version":"4.0","rubygems":"latest","bundler":"default","experimental":false}]'
|
|
91
129
|
matrix_os: ${{ github.event_name == 'pull_request' && '["ubuntu-latest","windows-latest"]' || '' }}
|
|
130
|
+
# metanorma/ci's tool-setup-action retired inkscape and ghostscript
|
|
131
|
+
# (2026-11-12) and ffmpeg (2026-11-26), so those setup-tools names
|
|
132
|
+
# are ignored and ukiryu's specs for them are skipped rather than
|
|
133
|
+
# run. Install them here, the way the retired actions did.
|
|
134
|
+
before-setup-ruby: |
|
|
135
|
+
case "$RUNNER_OS" in
|
|
136
|
+
Linux)
|
|
137
|
+
sudo apt-get update
|
|
138
|
+
sudo apt-get install -y --no-install-recommends inkscape ghostscript ffmpeg
|
|
139
|
+
;;
|
|
140
|
+
macOS)
|
|
141
|
+
export HOMEBREW_NO_AUTO_UPDATE=1
|
|
142
|
+
HOMEBREW_CASK_OPTS=--no-quarantine brew install --cask inkscape
|
|
143
|
+
brew install ghostscript ffmpeg
|
|
144
|
+
;;
|
|
145
|
+
Windows)
|
|
146
|
+
choco install --no-progress -y inkscape ghostscript ffmpeg
|
|
147
|
+
;;
|
|
148
|
+
esac
|
|
92
149
|
after-setup-ruby: |
|
|
93
150
|
if [ -f frontend/package.json ]; then cd frontend && npm install && npm run build; fi
|
|
94
151
|
secrets:
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: LML conformance
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
ruby:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
env:
|
|
19
|
+
LML_MML_ROOT: ${{ github.workspace }}/.lml-inputs/mml
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v6
|
|
22
|
+
with:
|
|
23
|
+
submodules: recursive
|
|
24
|
+
- name: Check out the pinned source for available MML pilots
|
|
25
|
+
if: ${{ hashFiles('scripts/lml/export_mml.rb') != '' }}
|
|
26
|
+
uses: actions/checkout@v6
|
|
27
|
+
with:
|
|
28
|
+
repository: plurimath/mml
|
|
29
|
+
ref: d826d80f6b1477569c8320ccd945268a6ce1062f
|
|
30
|
+
path: .lml-inputs/mml
|
|
31
|
+
persist-credentials: false
|
|
32
|
+
- uses: ruby/setup-ruby@v1
|
|
33
|
+
with:
|
|
34
|
+
ruby-version: "3.4"
|
|
35
|
+
bundler-cache: false
|
|
36
|
+
- name: Install dependencies
|
|
37
|
+
run: bundle install
|
|
38
|
+
- name: Replay pinned core and preservation packages
|
|
39
|
+
run: |
|
|
40
|
+
bundle exec ruby scripts/lml/export_conformance.rb --check
|
|
41
|
+
bundle exec ruby scripts/lml/export_preservation.rb --check
|
|
42
|
+
- name: Verify deterministic oracle regeneration
|
|
43
|
+
run: |
|
|
44
|
+
bundle exec ruby scripts/lml/export_conformance.rb --package "$RUNNER_TEMP/lml-core"
|
|
45
|
+
bundle exec ruby scripts/lml/export_preservation.rb --package "$RUNNER_TEMP/lml-preservation"
|
|
46
|
+
diff -r spec/fixtures/lml_conformance/core "$RUNNER_TEMP/lml-core"
|
|
47
|
+
diff -r spec/fixtures/lml_conformance/preservation "$RUNNER_TEMP/lml-preservation"
|
|
48
|
+
- name: Validate schema compatibility and fresh-process reconstruction
|
|
49
|
+
run: |
|
|
50
|
+
bundle exec ruby -rrspec/core -e 'RSpec.configure { |config| config.fail_if_no_examples = true }; exit RSpec::Core::Runner.run(ARGV)' -- spec/lutaml/model/lml_*_spec.rb
|
|
51
|
+
- name: Verify available MML pilot packages
|
|
52
|
+
run: |
|
|
53
|
+
if [[ -f scripts/lml/export_mml.rb ]]; then
|
|
54
|
+
test -f spec/lutaml/model/lml_mml_pilot_spec.rb
|
|
55
|
+
bundle exec ruby scripts/lml/export_mml.rb --check
|
|
56
|
+
bundle exec ruby -rrspec/core -e 'RSpec.configure { |config| config.fail_if_no_examples = true }; exit RSpec::Core::Runner.run(ARGV)' -- spec/lutaml/model/lml_mml_pilot_spec.rb
|
|
57
|
+
if [[ -f spec/lutaml/model/lml_mml_materialization_spec.rb ]]; then
|
|
58
|
+
bundle exec ruby -rrspec/core -e 'RSpec.configure { |config| config.fail_if_no_examples = true }; exit RSpec::Core::Runner.run(ARGV)' -- spec/lutaml/model/lml_mml_materialization_spec.rb
|
|
59
|
+
fi
|
|
60
|
+
else
|
|
61
|
+
echo "MML pilot package is not present in this revision."
|
|
62
|
+
fi
|
|
63
|
+
- name: Ensure verification leaves fixtures unchanged
|
|
64
|
+
run: |
|
|
65
|
+
git diff --exit-code -- spec/fixtures scripts/lml
|
|
66
|
+
untracked="$(git status --porcelain -- spec/fixtures scripts/lml)"
|
|
67
|
+
if [ -n "$untracked" ]; then
|
|
68
|
+
echo "Verification left untracked or modified files:"
|
|
69
|
+
echo "$untracked"
|
|
70
|
+
exit 1
|
|
71
|
+
fi
|
data/.gitignore
CHANGED
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
# rspec failure tracking
|
|
13
13
|
.rspec_status
|
|
14
14
|
|
|
15
|
+
# LML mml pilot payloads: fetched from lutaml/lutaml-model-corpus at a
|
|
16
|
+
# pinned commit and verified against spec/fixtures/lml_mml/manifest.json
|
|
17
|
+
/spec/fixtures/lml_mml/v3-math-nested.json
|
|
18
|
+
/spec/fixtures/lml_mml/v3-math-nested.yaml
|
|
19
|
+
/spec/fixtures/lml_mml/v4-math-nested.json
|
|
20
|
+
/spec/fixtures/lml_mml/v4-math-nested.yaml
|
|
21
|
+
|
|
15
22
|
# Direnv
|
|
16
23
|
.direnv/
|
|
17
24
|
|
data/README.adoc
CHANGED
|
@@ -59,6 +59,7 @@ link:docs/migration-guides/0-1-0-migrate-from-shale.adoc[Migrating from Shale to
|
|
|
59
59
|
* Deep object comparison and visual diff generation with similarity scoring
|
|
60
60
|
* Generate serialization schemas from model definitions (<<schema-generation>>)
|
|
61
61
|
* Import serialization schemas to define models (<<schema-import>>)
|
|
62
|
+
* Export portable, versioned model declarations with the opt-in link:docs/_guides/lml-cross-language.adoc[LML cross-language contract]
|
|
62
63
|
* Create custom adapters for additional data formats (see <<custom-adapters>>)
|
|
63
64
|
* Dynamically modify model attribute types using registers (see <<custom-registers>>)
|
|
64
65
|
* Per-class default register for versioned schemas (e.g., MathML v2, v3)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
= Cross-language models with LML
|
|
2
|
+
|
|
3
|
+
LML (LutaML Model Language) is the opt-in boundary between a model declaration
|
|
4
|
+
and target-specific code. A Ruby exporter can describe attributes and format
|
|
5
|
+
mappings as neutral data. A consumer in another language can validate that data
|
|
6
|
+
and materialize its own model and writers. The contract is effective now; v2
|
|
7
|
+
bundle import, reconstruction, generators, and CLI commands are still landing.
|
|
8
|
+
See the link:../_references/lml-contract[LML contract reference] for the exact
|
|
9
|
+
wire format and current capability status.
|
|
10
|
+
|
|
11
|
+
== Start with the current Ruby projection
|
|
12
|
+
|
|
13
|
+
The Ruby v1 API exports a supported `Serializable` model and verifies it against
|
|
14
|
+
the current source class:
|
|
15
|
+
|
|
16
|
+
[source,ruby]
|
|
17
|
+
----
|
|
18
|
+
document = Lutaml::Model::Lml.export(Catalog::Item)
|
|
19
|
+
File.write("item.lml.json", document.to_json)
|
|
20
|
+
Lutaml::Model::Lml.verify(document)
|
|
21
|
+
----
|
|
22
|
+
|
|
23
|
+
`verify` is a source-drift check: it resolves the Ruby class named by the
|
|
24
|
+
document, exports that class again, and compares canonical declarations. It does
|
|
25
|
+
not build a replacement class. This v1 API does not yet export a portable v2
|
|
26
|
+
graph bundle.
|
|
27
|
+
|
|
28
|
+
== Planned portable workflow
|
|
29
|
+
|
|
30
|
+
The v2 workflow is opt-in and validates a complete dependency graph before
|
|
31
|
+
building target classes. Model IDs combine the portable model identity with its
|
|
32
|
+
effective register. References, nested models, value types, and discriminator
|
|
33
|
+
cases resolve by ID, so a target may choose different local class names.
|
|
34
|
+
|
|
35
|
+
The intended consumer sequence is:
|
|
36
|
+
|
|
37
|
+
. Export roots and their graph into a versioned LML bundle.
|
|
38
|
+
. Validate document versions, IDs, references, defaults, capabilities, and
|
|
39
|
+
checksums.
|
|
40
|
+
. Verify the pinned manifest, generator, source, corpus, dependencies, and file
|
|
41
|
+
hashes before loading artifacts.
|
|
42
|
+
. Materialize classes using trusted target bindings, then apply mappings.
|
|
43
|
+
. Run the pinned replay cases and report expected/executed IDs and counts.
|
|
44
|
+
|
|
45
|
+
The Ruby bundle exporter/importer, standalone TypeScript and Rust package
|
|
46
|
+
commands, artifact verification command, and CLI syntax are **PENDING**. The
|
|
47
|
+
contract names the operations, but their invocation syntax is not shipped. Do
|
|
48
|
+
not copy a pending command into a build or release script as if it were usable.
|
|
49
|
+
|
|
50
|
+
== Versions and target capabilities
|
|
51
|
+
|
|
52
|
+
|===
|
|
53
|
+
| Contract surface | Version and opt-in boundary | Availability at base `8a8ef040`
|
|
54
|
+
|
|
55
|
+
| Existing Ruby export
|
|
56
|
+
| v1 document; existing checksum rules
|
|
57
|
+
| Available as `Lutaml::Model::Lml.export` and `.verify`.
|
|
58
|
+
|
|
59
|
+
| Portable document
|
|
60
|
+
| v2 model documents in a v1 bundle; explicit opt-in exact codecs
|
|
61
|
+
| Contract effective; bundle producer/validator pending.
|
|
62
|
+
|
|
63
|
+
| Artifact
|
|
64
|
+
| Manifest v1, schema v2, pinned generator, target, capability and file digests
|
|
65
|
+
| Verifier and consumer loading pending.
|
|
66
|
+
|
|
67
|
+
| Ruby generation/reconstruction
|
|
68
|
+
| Validate, materialize, then apply mappings
|
|
69
|
+
| Pending; current `verify` only checks for source drift.
|
|
70
|
+
|
|
71
|
+
| TypeScript / Rust / WASM
|
|
72
|
+
| Same stable model IDs and semantic source/corpus pins; target-specific bytes
|
|
73
|
+
| Generators and consumer packages pending at this base.
|
|
74
|
+
|
|
75
|
+
| CLI
|
|
76
|
+
| Import, export, and compile operations
|
|
77
|
+
| Pending; no stable command syntax yet.
|
|
78
|
+
|===
|
|
79
|
+
|
|
80
|
+
Capabilities are declared as a sorted unique list. A consumer must reject a
|
|
81
|
+
missing required capability with `capability_missing`; it must not silently
|
|
82
|
+
ignore a mapping or type it cannot implement. Exact portable values use decimal
|
|
83
|
+
strings at cross-language boundaries, preserving precision and authored lexical
|
|
84
|
+
form. Portable codecs are opt-in and do not change existing Ruby serializers.
|
|
85
|
+
|
|
86
|
+
== Keep behavior in the target package
|
|
87
|
+
|
|
88
|
+
LML contains data, not Ruby method bodies or callbacks. Custom constructors,
|
|
89
|
+
Proc defaults, imperative element-order behavior, and custom serialization code
|
|
90
|
+
remain handwritten and produce named rejections when they cannot be represented
|
|
91
|
+
faithfully. Generated files contain the model and mapping declarations only;
|
|
92
|
+
the target application owns writers and behavior.
|
|
93
|
+
|
|
94
|
+
A compile-time PARG binding hook can associate a grammar rule with a stable LML
|
|
95
|
+
class ID for coradoc M2. Keep the binding outside the LML document so the same
|
|
96
|
+
schema can be consumed in Ruby, TypeScript, Rust, or WASM. A Ruby consumer may
|
|
97
|
+
prepend an external handwritten behavior module to a class produced by
|
|
98
|
+
`Schema::ClassLoader`; the module remains consumer-owned and is not folded into
|
|
99
|
+
the generated artifact. The hook and command/API details are **PENDING** until
|
|
100
|
+
they land.
|
|
101
|
+
|
|
102
|
+
Keep each consumer package standalone, with its own manifest, dependency pins,
|
|
103
|
+
replay corpus index, and CI. This permits future package relocation without
|
|
104
|
+
changing LML IDs or making the core repository a runtime dependency.
|
|
105
|
+
|
|
106
|
+
=== Generated corpora live outside the working tree
|
|
107
|
+
|
|
108
|
+
The real mml pilot's exported graph payloads are hundreds of thousands of
|
|
109
|
+
lines, so they are not carried in this repository. They live in
|
|
110
|
+
link:https://github.com/lutaml/lutaml-model-corpus[lutaml/lutaml-model-corpus],
|
|
111
|
+
and `spec/support/lml_corpus.rb` fetches them at a pinned commit into
|
|
112
|
+
`spec/fixtures/lml_mml/` (gitignored) before the pilot and materialization
|
|
113
|
+
specs, or `scripts/lml/export_mml.rb --check`, read them. Every fetched file is
|
|
114
|
+
verified against the sha256 entries of
|
|
115
|
+
`spec/fixtures/lml_mml/manifest.json`; a mismatch is an error, never a silent
|
|
116
|
+
rewrite. The package's small files and the manifest stay in this repository.
|
|
117
|
+
|
|
118
|
+
To publish a regenerated corpus: run `bundle exec ruby scripts/lml/export_mml.rb`
|
|
119
|
+
(the mml source is pinned inside that script), copy the payload files into
|
|
120
|
+
lutaml-model-corpus under `lml_mml/`, merge them there, then point `REVISION` in
|
|
121
|
+
`spec/support/lml_corpus.rb` at the merged commit and commit the regenerated
|
|
122
|
+
manifest in the same change.
|
|
123
|
+
|
|
124
|
+
== See also
|
|
125
|
+
|
|
126
|
+
* link:../_references/lml-contract[LML contract reference]
|
|
127
|
+
* link:../_guides/grammar-backed-formats[Grammar-backed string formats]
|
|
128
|
+
* link:../_guides/gem-integration[Integrating lutaml-model in a gem]
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
= LML core conformance replay
|
|
2
|
+
|
|
3
|
+
The independently owned `spec/fixtures/lml_conformance/core` package is generated
|
|
4
|
+
by Ruby declarations in `spec/support/lml_conformance.rb`. It does not import a
|
|
5
|
+
parallel exporter's output as its oracle. `core-v2` pins the source baseline,
|
|
6
|
+
contract-authored v2 schema, Ruby parse/serialize results and negative results.
|
|
7
|
+
Changes to case meaning require a new generation and reviewed fixture updates.
|
|
8
|
+
Other corpus packages own separate indices and generators; there is no master
|
|
9
|
+
index and this generator never rewrites another package.
|
|
10
|
+
|
|
11
|
+
Run from the repository root:
|
|
12
|
+
|
|
13
|
+
[source,sh]
|
|
14
|
+
----
|
|
15
|
+
bundle exec ruby -Ilib scripts/lml/export_conformance.rb --check
|
|
16
|
+
bundle exec rspec spec/lutaml/model/lml_conformance_spec.rb
|
|
17
|
+
----
|
|
18
|
+
|
|
19
|
+
Without `--check`, the script regenerates the core package. `--package DIRECTORY`
|
|
20
|
+
selects an explicit copy of this package for replay or regeneration. The checker
|
|
21
|
+
never writes, and exits nonzero on missing, duplicate, unknown, changed or corrupt
|
|
22
|
+
cases/files. Its JSON report lists expected/executed IDs, both counts and errors
|
|
23
|
+
identified by case ID (or `package/PATH` for file failures). The runner executes
|
|
24
|
+
all supported cases, including expected failures, instead of treating an index
|
|
25
|
+
entry as evidence of implementation.
|
|
26
|
+
|
|
27
|
+
`index.json` follows corpus version 1, with generation, source revision, model ID,
|
|
28
|
+
semantic bundle checksum, input, normalized expected data, expected output,
|
|
29
|
+
comparison and structured expected error. `schema.json` and safely parsed
|
|
30
|
+
`schema.yaml` must describe the same neutral tree. Canonical JSON is UTF-8 compact
|
|
31
|
+
JSON with recursively sorted object keys, original array order, no BOM/trailing
|
|
32
|
+
newline and no Unicode normalization. The bundle checksum excludes provenance.
|
|
33
|
+
`manifest.json` version 1 hashes each payload's actual bytes, the index generation,
|
|
34
|
+
and the baseline gemspec dependency; it does not hash itself. Its external digest
|
|
35
|
+
is `sha256:` followed by SHA-256 of the complete canonical manifest bytes.
|
|
36
|
+
|
|
37
|
+
Every case explicitly names its `wire_profile` and `data_profile`. The four
|
|
38
|
+
original cases use `ruby-native-v1`: the existing Ruby XML/JSON mappings with the
|
|
39
|
+
Nokogiri XML adapter explicitly scoped for each execution. Their inputs and
|
|
40
|
+
outputs retain the original bytes, including numeric JSON `count:42`.
|
|
41
|
+
`data_profile:exact-values-decimal-v1` normalizes integer data to decimal strings;
|
|
42
|
+
booleans remain JSON booleans. Native numeric JSON is not portable exact JSON.
|
|
43
|
+
Model YAML I/O is not claimed. YAML here is a schema representation only.
|
|
44
|
+
|
|
45
|
+
`core-json-portable-exact` uses `wire_profile:portable-exact-json-v1` with the same
|
|
46
|
+
model/schema ID. Its input and expected output both contain the JSON string
|
|
47
|
+
`"count":"9007199254740993"`, above binary64's exact-integer range. A deliberately
|
|
48
|
+
small opt-in boundary for this three-field Ruby Record validates decimal-string
|
|
49
|
+
syntax, parses with `Integer(value, 10)`, supplies already typed data to the native
|
|
50
|
+
model, and emits the model's integer as a decimal string. It never uses Float and
|
|
51
|
+
rejects numeric input; it does not change existing serializers. This also avoids
|
|
52
|
+
the native String integer cast's Float conversion. Generated string-only codecs
|
|
53
|
+
can replay this case directly, without accepting native numeric wire values.
|
|
54
|
+
|
|
55
|
+
The index's `profiles` table lists `required_case_ids`; `target_profiles` requires
|
|
56
|
+
both profiles for Ruby and `portable-exact-json-v1` for Rust/TS. Consumers must
|
|
57
|
+
report the required profiles, expected/executed IDs and errors for each missing
|
|
58
|
+
required case. Passing native cases cannot substitute for the portable case.
|
|
59
|
+
Native-only IDs are explicitly outside Rust/TS's JSON profile, not silently
|
|
60
|
+
skipped. That JSON profile alone makes no XML replay claim. The Ruby `coverage`
|
|
61
|
+
helper demonstrates the same rule; its full replay requires all five cases.
|
|
62
|
+
All comparison modes still verify normalized data, and the portable case also
|
|
63
|
+
compares its actual string-valued JSON output to the expected output.
|
|
64
|
+
|
|
65
|
+
The pinned XML tree profile `expanded-names-text-v1` compares expanded namespace
|
|
66
|
+
URI/local names, sorted expanded attributes, significant decoded text and child
|
|
67
|
+
order. Namespace declarations and prefix spelling are excluded. Adjacent text
|
|
68
|
+
and CDATA merge into text. Whitespace is significant; DTDs, entity declarations,
|
|
69
|
+
processing instructions and unsupported nodes refuse. This is a restricted tree
|
|
70
|
+
profile, not W3C C14N. Separate `core-xml-bytes` assertions compare the serializer's
|
|
71
|
+
actual UTF-8 bytes, preserving declaration, prefix, escaping and formatting
|
|
72
|
+
choices. Tree equality never satisfies a required byte assertion.
|
|
73
|
+
|
|
74
|
+
The five baseline cases are `core-json`, `core-xml-tree`, `core-xml-bytes`,
|
|
75
|
+
`core-json-invalid` and `core-json-portable-exact`. They execute real Ruby models and preserve false, Unicode,
|
|
76
|
+
XML escaping, integer normalization and named parser failure. Namespace/state/
|
|
77
|
+
ordered-content preservation belongs to the independently generated preservation
|
|
78
|
+
package and is not claimed by this basic core corpus.
|