lutaml-model 0.8.206 → 0.8.208
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/bench/baselines/main_mml.json +20 -20
- data/bench/baselines/main_niso.json +15 -15
- data/bench/baselines/main_sts.json +20 -20
- data/bench/baselines/main_unitsml.json +5 -5
- data/bench/baselines/main_xmi.json +20 -20
- data/docs/_guides/native-engines.adoc +16 -0
- data/docs/cli_compare.adoc +4 -0
- data/lib/lutaml/model/cli.rb +7 -1
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/xml/adapter/plan_based_builder.rb +16 -0
- data/lib/lutaml/xml/adapter/xml_parser.rb +10 -5
- data/lib/lutaml/xml/adapter/xml_serializer.rb +1 -0
- data/lib/lutaml/xml/leptris/native_emission.rb +5 -0
- data/lib/lutaml/xml/leptris/plan_hydrator.rb +46 -9
- data/lib/lutaml/xml/leptris/plan_serializer.rb +101 -17
- data/lib/lutaml/xml/model_transform.rb +98 -30
- data/lutaml-model.gemspec +1 -1
- data/spec/fixtures/lml_conformance/core/manifest.json +1 -1
- data/spec/fixtures/lml_conformance/preservation/manifest.json +1 -1
- data/spec/lutaml/model/cli_spec.rb +6 -16
- data/spec/lutaml/model/lml_review_round5_spec.rb +7 -3
- data/spec/lutaml/model/render_nil_spec.rb +2 -1
- data/spec/lutaml/model/unmatched_rule_replay_spec.rb +127 -0
- data/spec/lutaml/model/value_map_spec.rb +2 -1
- data/spec/lutaml/model/writer_assigned_attribute_spec.rb +61 -0
- data/spec/lutaml/xml/leptris/plan_hydrator_bridge_scope_spec.rb +151 -0
- data/spec/lutaml/xml/production_lane_parity_spec.rb +147 -0
- data/spec/spec_helper.rb +18 -1
- metadata +8 -12
|
@@ -500,6 +500,81 @@ module ProductionLaneParitySpec
|
|
|
500
500
|
end
|
|
501
501
|
end
|
|
502
502
|
|
|
503
|
+
# A namespaced model with a raw capture: the parsed root's extra
|
|
504
|
+
# declarations must survive the round trip (the interpretive writer's
|
|
505
|
+
# stored-plan behavior).
|
|
506
|
+
RawDocNs = Class.new(Lutaml::Xml::W3c::XmlNamespace) do
|
|
507
|
+
uri "http://example.com/production-lane/raw-doc"
|
|
508
|
+
prefix_default "d"
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
class RawDoc < Lutaml::Model::Serializable
|
|
512
|
+
attribute :title, :string
|
|
513
|
+
attribute :svg_data, :string
|
|
514
|
+
|
|
515
|
+
xml do
|
|
516
|
+
element "doc"
|
|
517
|
+
namespace RawDocNs
|
|
518
|
+
map_element "title", to: :title
|
|
519
|
+
map_element "svg", to: :svg_data, raw: :element
|
|
520
|
+
end
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
DoubledNs = Class.new(Lutaml::Xml::W3c::XmlNamespace) do
|
|
524
|
+
uri "http://example.com/production-lane/doubled"
|
|
525
|
+
prefix_default "ex"
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
class Doubled < Lutaml::Model::Serializable
|
|
529
|
+
attribute :title, :string
|
|
530
|
+
attribute :code, :string
|
|
531
|
+
|
|
532
|
+
xml do
|
|
533
|
+
element "doubled"
|
|
534
|
+
namespace DoubledNs
|
|
535
|
+
map_element "title", to: :title
|
|
536
|
+
map_attribute "code", to: :code
|
|
537
|
+
end
|
|
538
|
+
end
|
|
539
|
+
|
|
540
|
+
class NilMarked < Lutaml::Model::Serializable
|
|
541
|
+
attribute :name, :string
|
|
542
|
+
attribute :note, :string
|
|
543
|
+
|
|
544
|
+
xml do
|
|
545
|
+
element "nil-marked"
|
|
546
|
+
map_element "name", to: :name
|
|
547
|
+
map_element "note", to: :note, render_nil: true
|
|
548
|
+
end
|
|
549
|
+
end
|
|
550
|
+
|
|
551
|
+
class StrictParsed < Lutaml::Model::Serializable
|
|
552
|
+
attribute :name, :string
|
|
553
|
+
|
|
554
|
+
xml do
|
|
555
|
+
element "strict"
|
|
556
|
+
map_content to: :name
|
|
557
|
+
end
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
class UnmappedChildContent < Lutaml::Model::Serializable
|
|
561
|
+
attribute :content, :string
|
|
562
|
+
|
|
563
|
+
xml do
|
|
564
|
+
element "unmapped-content"
|
|
565
|
+
map_content to: :content
|
|
566
|
+
end
|
|
567
|
+
end
|
|
568
|
+
|
|
569
|
+
class UnmappedHolder < Lutaml::Model::Serializable
|
|
570
|
+
attribute :inner, UnmappedChildContent
|
|
571
|
+
|
|
572
|
+
xml do
|
|
573
|
+
element "holder"
|
|
574
|
+
map_element "unmapped-content", to: :inner
|
|
575
|
+
end
|
|
576
|
+
end
|
|
577
|
+
|
|
503
578
|
# An unordered mapping whose instances may carry a tracked
|
|
504
579
|
# element_order (the order-tracker pattern, lutaml-model#977).
|
|
505
580
|
class Tracked < Lutaml::Model::Serializable
|
|
@@ -870,6 +945,78 @@ RSpec.describe "production-lane parity" do
|
|
|
870
945
|
expect(doc.to_xml).to be_xml_equivalent_to(xml)
|
|
871
946
|
end
|
|
872
947
|
|
|
948
|
+
describe "source declarations" do
|
|
949
|
+
it "keeps the prefix a captured raw fragment spells" do
|
|
950
|
+
source = '<d:doc xmlns:d="http://example.com/production-lane/raw-doc" ' \
|
|
951
|
+
'xmlns:s="http://www.w3.org/2000/svg">' \
|
|
952
|
+
"<d:title>T</d:title><s:svg><s:rect/></s:svg></d:doc>"
|
|
953
|
+
output = ProductionLaneParitySpec::RawDoc.from_xml(source).to_xml
|
|
954
|
+
|
|
955
|
+
expect(output).to include('xmlns:d="http://example.com/production-lane/raw-doc"',
|
|
956
|
+
'xmlns:s="http://www.w3.org/2000/svg"', "<s:svg>")
|
|
957
|
+
end
|
|
958
|
+
|
|
959
|
+
it "keeps an extra vocabulary the parsed root declared" do
|
|
960
|
+
source = '<ex:doubled xmlns:ex="http://example.com/production-lane/doubled" ' \
|
|
961
|
+
'xmlns:x="http://example.com/production-lane/extra" ex:code="c">' \
|
|
962
|
+
"<ex:title>T</ex:title></ex:doubled>"
|
|
963
|
+
output = ProductionLaneParitySpec::Doubled.from_xml(source).to_xml
|
|
964
|
+
|
|
965
|
+
expect(output).to include('xmlns:ex="http://example.com/production-lane/doubled"',
|
|
966
|
+
'xmlns:x="http://example.com/production-lane/extra"')
|
|
967
|
+
end
|
|
968
|
+
|
|
969
|
+
it "keeps a second prefix a default-namespace root bound its namespace to" do
|
|
970
|
+
source = '<doubled xmlns="http://example.com/production-lane/doubled" ' \
|
|
971
|
+
'xmlns:b="http://example.com/production-lane/doubled" code="c">' \
|
|
972
|
+
"<title>T</title></doubled>"
|
|
973
|
+
output = ProductionLaneParitySpec::Doubled.from_xml(source).to_xml
|
|
974
|
+
|
|
975
|
+
expect(output).to include('xmlns="http://example.com/production-lane/doubled"',
|
|
976
|
+
'xmlns:b="http://example.com/production-lane/doubled"')
|
|
977
|
+
end
|
|
978
|
+
end
|
|
979
|
+
|
|
980
|
+
describe "parse and render contracts" do
|
|
981
|
+
it "declares the xsi prefix when a nil-marked element is rendered" do
|
|
982
|
+
output = ProductionLaneParitySpec::NilMarked.new(name: "a", note: nil).to_xml
|
|
983
|
+
|
|
984
|
+
expect(output).to include(
|
|
985
|
+
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"', 'xsi:nil="true"'
|
|
986
|
+
)
|
|
987
|
+
expect { Lutaml::Xml.adapter.parse(output) }.not_to raise_error
|
|
988
|
+
end
|
|
989
|
+
|
|
990
|
+
it "raises on malformed input under strict: true" do
|
|
991
|
+
expect do
|
|
992
|
+
ProductionLaneParitySpec::StrictParsed.from_xml(
|
|
993
|
+
"<?xml version='1.0'?><strict>>malformed<<xml>", strict: true
|
|
994
|
+
)
|
|
995
|
+
end.to raise_error(Lutaml::Model::InvalidFormatError)
|
|
996
|
+
end
|
|
997
|
+
|
|
998
|
+
it "leaves a parsed instance pristine" do
|
|
999
|
+
parsed = ProductionLaneParitySpec::NilMarked.from_xml(
|
|
1000
|
+
"<nil-marked><name>a</name></nil-marked>",
|
|
1001
|
+
)
|
|
1002
|
+
expect(parsed.mutated_after_parse?).to be(false)
|
|
1003
|
+
|
|
1004
|
+
parsed.name = "b"
|
|
1005
|
+
expect(parsed.mutated_after_parse?).to be(true)
|
|
1006
|
+
end
|
|
1007
|
+
|
|
1008
|
+
it "binds the runs of a singular content element split by an unmapped child" do
|
|
1009
|
+
at_root = ProductionLaneParitySpec::UnmappedChildContent.from_xml(
|
|
1010
|
+
"<unmapped-content>a<unknown/></unmapped-content>",
|
|
1011
|
+
)
|
|
1012
|
+
nested = ProductionLaneParitySpec::UnmappedHolder.from_xml(
|
|
1013
|
+
"<holder><unmapped-content>one<unknown/>two</unmapped-content></holder>",
|
|
1014
|
+
)
|
|
1015
|
+
expect(at_root.content).to eq(["a"])
|
|
1016
|
+
expect(nested.inner.content).to eq(["one", "two"])
|
|
1017
|
+
end
|
|
1018
|
+
end
|
|
1019
|
+
|
|
873
1020
|
describe "conversion caching" do
|
|
874
1021
|
let(:store) { Lutaml::Store::BasicStore.new(adapter: { type: :memory }) }
|
|
875
1022
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -39,12 +39,29 @@ RSpec.configure do |config|
|
|
|
39
39
|
# machinery follows the CURRENT config by design (#1184), which
|
|
40
40
|
# turned that leak into order-dependent schema-suite failures —
|
|
41
41
|
# the restore pins every example back to the spec_helper default.
|
|
42
|
+
#
|
|
43
|
+
# "Previous" has three shapes and each needs its own restore: a type
|
|
44
|
+
# name, a pre-resolved adapter class (the resolver records it under
|
|
45
|
+
# its internal fixed-adapter marker, which the type setter refuses),
|
|
46
|
+
# or nothing — the production lane, which a leaked pin must be
|
|
47
|
+
# UNSET from rather than left in place. Skipping the nil case let the
|
|
48
|
+
# first spec that pinned :nokogiri hand every later spec that engine:
|
|
49
|
+
# the suite then passed on output the production leptris lane never
|
|
50
|
+
# produced (cdata rules serialized as escaped text).
|
|
42
51
|
config.around do |example|
|
|
43
52
|
previous = Lutaml::Model::Config.xml_adapter_type
|
|
53
|
+
fixed = previous == Lutaml::Model::FIXED_ADAPTER_TYPE
|
|
54
|
+
previous_adapter = Lutaml::Model::Config.xml_adapter if fixed
|
|
44
55
|
begin
|
|
45
56
|
example.run
|
|
46
57
|
ensure
|
|
47
|
-
|
|
58
|
+
if fixed
|
|
59
|
+
Lutaml::Model::Config.xml_adapter = previous_adapter
|
|
60
|
+
elsif previous
|
|
61
|
+
Lutaml::Model::Config.xml_adapter_type = previous
|
|
62
|
+
else
|
|
63
|
+
Lutaml::Model::Config.unset_xml_adapter_type
|
|
64
|
+
end
|
|
48
65
|
end
|
|
49
66
|
end
|
|
50
67
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.208
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-12-
|
|
11
|
+
date: 2026-12-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -70,22 +70,16 @@ dependencies:
|
|
|
70
70
|
name: liquid
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- - "
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '4.0'
|
|
76
|
-
- - "<"
|
|
73
|
+
- - "~>"
|
|
77
74
|
- !ruby/object:Gem::Version
|
|
78
|
-
version: '
|
|
75
|
+
version: '5.14'
|
|
79
76
|
type: :runtime
|
|
80
77
|
prerelease: false
|
|
81
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
82
79
|
requirements:
|
|
83
|
-
- - "
|
|
84
|
-
- !ruby/object:Gem::Version
|
|
85
|
-
version: '4.0'
|
|
86
|
-
- - "<"
|
|
80
|
+
- - "~>"
|
|
87
81
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: '
|
|
82
|
+
version: '5.14'
|
|
89
83
|
- !ruby/object:Gem::Dependency
|
|
90
84
|
name: moxml
|
|
91
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -2279,6 +2273,7 @@ files:
|
|
|
2279
2273
|
- spec/lutaml/model/union_attribute_spec.rb
|
|
2280
2274
|
- spec/lutaml/model/union_lenient_model_spec.rb
|
|
2281
2275
|
- spec/lutaml/model/union_spec.rb
|
|
2276
|
+
- spec/lutaml/model/unmatched_rule_replay_spec.rb
|
|
2282
2277
|
- spec/lutaml/model/unregistered_context_resolution_spec.rb
|
|
2283
2278
|
- spec/lutaml/model/utils_spec.rb
|
|
2284
2279
|
- spec/lutaml/model/validation/concerns/has_issues_spec.rb
|
|
@@ -2387,6 +2382,7 @@ files:
|
|
|
2387
2382
|
- spec/lutaml/xml/leptris/native_emission_ordered_spec.rb
|
|
2388
2383
|
- spec/lutaml/xml/leptris/native_emission_plain_model_spec.rb
|
|
2389
2384
|
- spec/lutaml/xml/leptris/native_emission_render_contract_spec.rb
|
|
2385
|
+
- spec/lutaml/xml/leptris/plan_hydrator_bridge_scope_spec.rb
|
|
2390
2386
|
- spec/lutaml/xml/leptris/plan_hydrator_ns_snapshot_spec.rb
|
|
2391
2387
|
- spec/lutaml/xml/leptris_string_encoding_spec.rb
|
|
2392
2388
|
- spec/lutaml/xml/line_ending_spec.rb
|