lutaml-model 0.8.23 → 0.8.24
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/performance.yml +1 -1
- data/Gemfile +6 -0
- data/README.adoc +16 -7
- data/docs/_guides/index.adoc +4 -0
- data/docs/_guides/native-engines.adoc +61 -0
- data/docs/_pages/configuration.adoc +11 -7
- data/docs/_pages/serialization_adapters.adoc +14 -5
- data/lib/compat/opal/lutaml_model_boot.rb +2 -0
- data/lib/lutaml/json/adapter/multi_json_adapter.rb +12 -1
- data/lib/lutaml/json/adapter/yeptris_adapter.rb +21 -0
- data/lib/lutaml/json/adapter.rb +1 -0
- data/lib/lutaml/json/format.rb +1 -1
- data/lib/lutaml/key_value/adapter/json/multi_json_adapter.rb +16 -1
- data/lib/lutaml/key_value/adapter/json/yeptris_adapter.rb +15 -0
- data/lib/lutaml/key_value/adapter/toml/teptris_adapter.rb +42 -0
- data/lib/lutaml/key_value/adapter/toml.rb +1 -0
- data/lib/lutaml/key_value/adapter/yaml/yeptris_adapter.rb +15 -0
- data/lib/lutaml/key_value/transform.rb +82 -0
- data/lib/lutaml/key_value/transformation/value_serializer.rb +25 -0
- data/lib/lutaml/key_value/transformation.rb +25 -1
- data/lib/lutaml/model/adapter_resolver.rb +23 -6
- data/lib/lutaml/model/attribute.rb +31 -6
- data/lib/lutaml/model/configuration.rb +5 -0
- data/lib/lutaml/model/error/unknown_adapter_type_error.rb +4 -4
- data/lib/lutaml/model/serialize/format_conversion.rb +37 -0
- data/lib/lutaml/model/toml.rb +10 -6
- data/lib/lutaml/model/type/date_time.rb +2 -2
- data/lib/lutaml/model/type/value.rb +24 -2
- data/lib/lutaml/model/utils.rb +6 -5
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/toml/adapter/teptris_adapter.rb +14 -0
- data/lib/lutaml/toml/adapter.rb +1 -0
- data/lib/lutaml/toml/format.rb +1 -1
- data/lib/lutaml/xml/adapter/leptris_adapter.rb +15 -0
- data/lib/lutaml/xml/adapter_element.rb +111 -3
- data/lib/lutaml/xml/builder/base.rb +3 -1
- data/lib/lutaml/xml/builder/leptris.rb +13 -0
- data/lib/lutaml/xml/builder/nokogiri.rb +3 -0
- data/lib/lutaml/xml/builder.rb +1 -0
- data/lib/lutaml/xml/format.rb +4 -1
- data/lib/lutaml/xml/leptris/element.rb +34 -0
- data/lib/lutaml/xml/plan_compiler.rb +139 -0
- data/lib/lutaml/xml/plan_hydrator.rb +80 -0
- data/lib/lutaml/xml/transformation/custom_method_wrapper.rb +8 -0
- data/lib/lutaml/xml/xml_element.rb +6 -2
- data/lib/lutaml/yaml/adapter/yeptris_adapter.rb +40 -0
- data/lib/lutaml/yaml/adapter.rb +5 -0
- data/lib/lutaml/yaml/format.rb +1 -1
- data/lib/tasks/performance.rake +5 -0
- data/lib/tasks/performance_comparator.rb +19 -3
- data/lib/tasks/performance_probe.rake +33 -0
- data/lib/tasks/performance_probe.rb +106 -0
- data/lib/tasks/performance_probe_xml.rb +54 -0
- data/lutaml-model.gemspec +1 -1
- data/spec/lutaml/json/yeptris_adapter_spec.rb +63 -0
- data/spec/lutaml/key_value/adapter/toml/teptris_adapter_spec.rb +71 -0
- data/spec/lutaml/model/json_adapter_spec.rb +6 -0
- data/spec/lutaml/model/toml_adapter_spec.rb +8 -0
- data/spec/lutaml/model/toml_spec.rb +36 -1
- data/spec/lutaml/xml/plan_fast_path_spec.rb +96 -0
- data/spec/lutaml/xml/xml_spec.rb +13 -0
- data/spec/lutaml/yaml/yeptris_adapter_spec.rb +63 -0
- data/spec/spec_helper.rb +7 -1
- metadata +23 -4
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
require "lutaml/key_value/adapter/toml/teptris_adapter"
|
|
5
|
+
begin
|
|
6
|
+
require "teptris"
|
|
7
|
+
rescue LoadError
|
|
8
|
+
# teptris is not resolvable here (absent or broken native library):
|
|
9
|
+
# every example skips.
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
TEPTRIS_AVAILABLE = defined?(Teptris)
|
|
13
|
+
|
|
14
|
+
RSpec.describe(TEPTRIS_AVAILABLE ? Lutaml::KeyValue::Adapter::Toml::TeptrisAdapter : Object) do
|
|
15
|
+
before { skip "teptris is not available" unless TEPTRIS_AVAILABLE }
|
|
16
|
+
|
|
17
|
+
describe ".parse" do
|
|
18
|
+
it "parses a TOML document into a hash" do
|
|
19
|
+
expect(described_class.parse("name = \"John\"\nage = 30\n"))
|
|
20
|
+
.to eq("name" => "John", "age" => 30)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "parses nested tables and arrays" do
|
|
24
|
+
toml = <<~TOML
|
|
25
|
+
title = "cfg"
|
|
26
|
+
[owner]
|
|
27
|
+
name = "t"
|
|
28
|
+
tags = ["a", "b"]
|
|
29
|
+
TOML
|
|
30
|
+
expect(described_class.parse(toml))
|
|
31
|
+
.to eq("title" => "cfg", "owner" => { "name" => "t", "tags" => %w[a b] })
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "materializes dates and datetimes like tomlib" do
|
|
35
|
+
require "date"
|
|
36
|
+
doc = described_class.parse("d = 1979-05-27\ndt = 1979-05-27T07:32:00Z\n")
|
|
37
|
+
expect(doc["d"]).to be_a(Date)
|
|
38
|
+
expect(doc["dt"]).to be_a(Time)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "reports parse errors with line and column" do
|
|
42
|
+
expect { described_class.parse("a = [1,") }
|
|
43
|
+
.to raise_error(Teptris::ParseError) do |e|
|
|
44
|
+
expect(e.line).to eq(1)
|
|
45
|
+
expect(e.column).to eq(8)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
describe "#to_toml" do
|
|
51
|
+
it "dumps a hash to TOML" do
|
|
52
|
+
attributes = { "name" => "x", "nested" => { "a" => [1, 2] } }
|
|
53
|
+
expect(described_class.new(attributes).to_toml)
|
|
54
|
+
.to include("name", "[nested]", "a = [1, 2]")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "unwraps the __root__ KeyValueElement wrapper" do
|
|
58
|
+
element = Lutaml::KeyValue::DataModel::Element.new("__root__")
|
|
59
|
+
name_child = Lutaml::KeyValue::DataModel::Element.new("name")
|
|
60
|
+
name_child.value = "x"
|
|
61
|
+
element.add_child(name_child)
|
|
62
|
+
expect(described_class.new(element).to_toml).to include("name")
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "round-trips through the model layer" do
|
|
67
|
+
attributes = { "name" => "John", "age" => 30 }
|
|
68
|
+
adapter_toml = described_class.new(attributes).to_toml
|
|
69
|
+
expect(described_class.parse(adapter_toml)).to eq(attributes)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require "spec_helper"
|
|
2
|
+
require "multi_json"
|
|
2
3
|
require "lutaml/key_value/adapter/json/standard_adapter"
|
|
3
4
|
require "lutaml/key_value/adapter/json/multi_json_adapter"
|
|
4
5
|
require "lutaml/key_value/adapter/json/oj_adapter"
|
|
@@ -37,6 +38,11 @@ RSpec.describe "JsonAdapter" do
|
|
|
37
38
|
end
|
|
38
39
|
|
|
39
40
|
describe Lutaml::KeyValue::Adapter::Json::MultiJsonAdapter do
|
|
41
|
+
# multi_json 1.21's json_gem adapter passes options positionally to
|
|
42
|
+
# JSON.parse, which json >= 3 removed (intridea/multi_json#227).
|
|
43
|
+
if Gem::Version.new(JSON::VERSION) >= Gem::Version.new("3")
|
|
44
|
+
before { skip "multi_json is incompatible with json #{JSON::VERSION} (intridea/multi_json#227)" }
|
|
45
|
+
end
|
|
40
46
|
it_behaves_like "a JSON adapter", described_class
|
|
41
47
|
end
|
|
42
48
|
|
|
@@ -17,6 +17,8 @@ RSpec.describe "TomlAdapter" do
|
|
|
17
17
|
TomlRB.dump(attributes)
|
|
18
18
|
elsif adapter_class == Lutaml::Model::Toml::TomlibAdapter
|
|
19
19
|
Tomlib.dump(attributes)
|
|
20
|
+
elsif adapter_class == Lutaml::Model::Toml::TeptrisAdapter && defined?(Teptris)
|
|
21
|
+
Teptris::TOML.dump(attributes)
|
|
20
22
|
end
|
|
21
23
|
end
|
|
22
24
|
|
|
@@ -45,4 +47,10 @@ RSpec.describe "TomlAdapter" do
|
|
|
45
47
|
it_behaves_like "a TOML adapter", described_class
|
|
46
48
|
end
|
|
47
49
|
end
|
|
50
|
+
|
|
51
|
+
if defined?(Teptris)
|
|
52
|
+
describe Lutaml::Model::Toml::TeptrisAdapter do
|
|
53
|
+
it_behaves_like "a TOML adapter", described_class
|
|
54
|
+
end
|
|
55
|
+
end
|
|
48
56
|
end
|
|
@@ -10,7 +10,7 @@ RSpec.describe Lutaml::Model::Toml do
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it "does not autoload native TOML adapters on Opal" do
|
|
13
|
-
%i[TomlRbAdapter TomlibAdapter].each do |constant_name|
|
|
13
|
+
%i[TomlRbAdapter TomlibAdapter TeptrisAdapter].each do |constant_name|
|
|
14
14
|
hide_const("Lutaml::Toml::Adapter::#{constant_name}")
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -19,12 +19,14 @@ RSpec.describe Lutaml::Model::Toml do
|
|
|
19
19
|
|
|
20
20
|
expect(Lutaml::Toml::Adapter.autoload?(:TomlRbAdapter)).to be_nil
|
|
21
21
|
expect(Lutaml::Toml::Adapter.autoload?(:TomlibAdapter)).to be_nil
|
|
22
|
+
expect(Lutaml::Toml::Adapter.autoload?(:TeptrisAdapter)).to be_nil
|
|
22
23
|
end
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
describe ".detect_toml_adapter" do
|
|
26
27
|
before do
|
|
27
28
|
# Hide any existing constants first
|
|
29
|
+
hide_const("Teptris") if Object.const_defined?(:Teptris)
|
|
28
30
|
hide_const("Tomlib") if Object.const_defined?(:Tomlib)
|
|
29
31
|
hide_const("TomlRb") if Object.const_defined?(:TomlRb)
|
|
30
32
|
|
|
@@ -32,6 +34,39 @@ RSpec.describe Lutaml::Model::Toml do
|
|
|
32
34
|
allow(Lutaml::Model::Utils).to receive(:require).and_return(true)
|
|
33
35
|
end
|
|
34
36
|
|
|
37
|
+
context "when teptris is available" do
|
|
38
|
+
before do
|
|
39
|
+
stub_const("Teptris", Module.new)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "returns :teptris on non-Windows platforms (tomlib absent)" do
|
|
43
|
+
allow(Gem).to receive(:win_platform?).and_return(false)
|
|
44
|
+
expect(described_class.detect_toml_adapter).to eq(:teptris)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "returns :teptris on Windows (native TOML without tomlib segfaults)" do
|
|
48
|
+
allow(Gem).to receive(:win_platform?).and_return(true)
|
|
49
|
+
expect(described_class.detect_toml_adapter).to eq(:teptris)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
context "when teptris and tomlib are both available" do
|
|
54
|
+
before do
|
|
55
|
+
stub_const("Teptris", Module.new)
|
|
56
|
+
stub_const("Tomlib", Module.new)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "prefers teptris on non-Windows (0.2.12+ beats tomlib both directions)" do
|
|
60
|
+
allow(Gem).to receive(:win_platform?).and_return(false)
|
|
61
|
+
expect(described_class.detect_toml_adapter).to eq(:teptris)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "prefers teptris on Windows" do
|
|
65
|
+
allow(Gem).to receive(:win_platform?).and_return(true)
|
|
66
|
+
expect(described_class.detect_toml_adapter).to eq(:teptris)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
35
70
|
context "when Tomlib is available" do
|
|
36
71
|
before do
|
|
37
72
|
stub_const("Tomlib", Module.new)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
RSpec.describe "XML plan fast path" do
|
|
6
|
+
let(:classes) do
|
|
7
|
+
item_class = Class.new(Lutaml::Model::Serializable) do
|
|
8
|
+
attribute :id, :integer
|
|
9
|
+
attribute :name, :string
|
|
10
|
+
attribute :tags, :string, collection: true
|
|
11
|
+
|
|
12
|
+
xml do
|
|
13
|
+
element "item"
|
|
14
|
+
map_attribute "id", to: :id
|
|
15
|
+
map_element "name", to: :name
|
|
16
|
+
map_element "tag", to: :tags
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
root_class = Class.new(Lutaml::Model::Serializable) do
|
|
20
|
+
attribute :item, item_class, collection: true
|
|
21
|
+
|
|
22
|
+
xml do
|
|
23
|
+
element "root"
|
|
24
|
+
map_element "item", to: :item
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
[item_class, root_class]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
let(:item_class) { classes[0] }
|
|
31
|
+
let(:root_class) { classes[1] }
|
|
32
|
+
|
|
33
|
+
around do |example|
|
|
34
|
+
old = Lutaml::Model::Config.instance.xml_plan_fast_path
|
|
35
|
+
Lutaml::Model::Config.instance.xml_plan_fast_path = true
|
|
36
|
+
example.run
|
|
37
|
+
ensure
|
|
38
|
+
Lutaml::Model::Config.instance.xml_plan_fast_path = old
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "is opt-in and off by default" do
|
|
42
|
+
expect(Lutaml::Model::Configuration.new.xml_plan_fast_path).to be(false)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "hydrates equal to the interpretive path" do
|
|
46
|
+
xml = root_class.new(item: [
|
|
47
|
+
item_class.new(id: 1, name: "a", tags: %w[x y]),
|
|
48
|
+
item_class.new(id: 2, name: "b", tags: %w[z]),
|
|
49
|
+
]).to_xml
|
|
50
|
+
|
|
51
|
+
expect(root_class.from_xml(xml).item).to eq(root_class.new(item: [
|
|
52
|
+
item_class.new(id: 1, name: "a", tags: %w[x y]),
|
|
53
|
+
item_class.new(id: 2, name: "b", tags: %w[z]),
|
|
54
|
+
]).item)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "matches the interpretive path on missing elements" do
|
|
58
|
+
xml = <<~XML
|
|
59
|
+
<root>
|
|
60
|
+
<item id="1"><name>A</name><tag>x</tag></item>
|
|
61
|
+
<item id="2"><tag>y</tag><tag>z</tag></item>
|
|
62
|
+
<item id="3"><name>C</name></item>
|
|
63
|
+
</root>
|
|
64
|
+
XML
|
|
65
|
+
|
|
66
|
+
parsed = root_class.from_xml(xml)
|
|
67
|
+
expect(parsed.item.map { |i| [i.id, i.name, i.tags] })
|
|
68
|
+
.to eq([[1, "A", %w[x]], [2, nil, %w[y z]], [3, "C", []]])
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "wraps engine parse errors as InvalidFormatError" do
|
|
72
|
+
Lutaml::Model::Config.with_adapter(xml: :leptris) do
|
|
73
|
+
expect { root_class.from_xml("<root><item>") }
|
|
74
|
+
.to raise_error(Lutaml::Model::InvalidFormatError)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it "falls back for non-compilable models" do
|
|
79
|
+
klass = Class.new(Lutaml::Model::Serializable) do
|
|
80
|
+
attribute :note, :string
|
|
81
|
+
|
|
82
|
+
xml do
|
|
83
|
+
element "doc"
|
|
84
|
+
map_element "note", to: :note, with: { from: :note_from }
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def note_from(instance, value)
|
|
88
|
+
instance.note = value.text
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
expect(Lutaml::Xml::PlanCompiler.compile(klass,
|
|
93
|
+
Lutaml::Model::Config.default_register)).to be_nil
|
|
94
|
+
expect(klass.from_xml("<doc><note>hi</note></doc>").note).to eq("hi")
|
|
95
|
+
end
|
|
96
|
+
end
|
data/spec/lutaml/xml/xml_spec.rb
CHANGED
|
@@ -120,6 +120,19 @@ RSpec.describe Lutaml::Xml do
|
|
|
120
120
|
hide_const("Ox") if Object.const_defined?(:Ox)
|
|
121
121
|
hide_const("Oga") if Object.const_defined?(:Oga)
|
|
122
122
|
hide_const("REXML") if Object.const_defined?(:REXML)
|
|
123
|
+
# When the leptris gem is in the bundle, moxml prefers it over every
|
|
124
|
+
# other engine; the legacy-detection contexts below must opt out to
|
|
125
|
+
# exercise the fallback chain.
|
|
126
|
+
allow(Moxml::Config).to receive(:leptris_preferred_available?)
|
|
127
|
+
.and_return(false)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
context "when the leptris engine is in the bundle" do
|
|
131
|
+
it "prefers :leptris" do
|
|
132
|
+
allow(Moxml::Config).to receive(:leptris_preferred_available?)
|
|
133
|
+
.and_return(true)
|
|
134
|
+
expect(described_class.detect_xml_adapter).to eq(:leptris)
|
|
135
|
+
end
|
|
123
136
|
end
|
|
124
137
|
|
|
125
138
|
context "when Nokogiri is available" do
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
begin
|
|
5
|
+
require "lutaml/yaml/adapter/yeptris_adapter"
|
|
6
|
+
rescue LoadError
|
|
7
|
+
# yeptris ships no platform gem here (e.g. Windows): every example skips.
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
YEPTRIS_AVAILABLE = defined?(Yeptris)
|
|
11
|
+
|
|
12
|
+
RSpec.describe(YEPTRIS_AVAILABLE ? Lutaml::Yaml::Adapter::YeptrisAdapter : Object) do
|
|
13
|
+
before { skip "yeptris is not available on this platform" unless YEPTRIS_AVAILABLE }
|
|
14
|
+
|
|
15
|
+
let(:attributes) { { "name" => "John", "roles" => %w[admin dev] } }
|
|
16
|
+
|
|
17
|
+
describe ".parse" do
|
|
18
|
+
it "parses a YAML document into a hash" do
|
|
19
|
+
expect(described_class.parse("name: John\nroles:\n - admin\n - dev\n"))
|
|
20
|
+
.to eq(attributes)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "round-trips nested structures" do
|
|
24
|
+
yaml = described_class.parse("outer:\n inner: 1\n")
|
|
25
|
+
expect(yaml).to eq("outer" => { "inner" => 1 })
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "supports the same permitted classes as the standard adapter" do
|
|
29
|
+
require "date"
|
|
30
|
+
expect(described_class.parse("d: 2020-01-01\n"))
|
|
31
|
+
.to eq("d" => Date.new(2020, 1, 1))
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe "#to_yaml" do
|
|
36
|
+
subject(:document) { described_class.new(attributes) }
|
|
37
|
+
|
|
38
|
+
it "serializes a hash to YAML that parses back identically" do
|
|
39
|
+
expect(described_class.parse(document.to_yaml)).to eq(attributes)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe "round trip through a model" do
|
|
44
|
+
let(:model_class) do
|
|
45
|
+
Class.new(Lutaml::Model::Serializable) do
|
|
46
|
+
attribute :name, :string
|
|
47
|
+
attribute :roles, :string, collection: true
|
|
48
|
+
|
|
49
|
+
key_value do
|
|
50
|
+
map "name", to: :name
|
|
51
|
+
map "roles", to: :roles
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "deserializes and serializes via the yeptris engine" do
|
|
57
|
+
model = model_class.from_yaml("name: John\nroles:\n - admin\n - dev\n")
|
|
58
|
+
expect(model.name).to eq("John")
|
|
59
|
+
expect(model.roles).to eq(%w[admin dev])
|
|
60
|
+
expect(model_class.from_yaml(model.to_yaml).roles).to eq(%w[admin dev])
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -99,7 +99,13 @@ require_relative "support/test_adapter_config"
|
|
|
99
99
|
# require_relative "../lib/lutaml/model/toml_adapter/toml_rb_adapter"
|
|
100
100
|
|
|
101
101
|
Lutaml::Model::Config.configure do |config|
|
|
102
|
-
config.xml_adapter_type = RUBY_ENGINE == "opal"
|
|
102
|
+
config.xml_adapter_type = if RUBY_ENGINE == "opal"
|
|
103
|
+
:oga
|
|
104
|
+
elsif ENV["XML_ADAPTER"]
|
|
105
|
+
ENV["XML_ADAPTER"].to_sym
|
|
106
|
+
else
|
|
107
|
+
:nokogiri
|
|
108
|
+
end
|
|
103
109
|
config.hash_adapter_type = :standard
|
|
104
110
|
config.json_adapter_type = :standard
|
|
105
111
|
config.yaml_adapter_type = :standard
|
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.24
|
|
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-09-
|
|
11
|
+
date: 2026-09-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -92,14 +92,14 @@ dependencies:
|
|
|
92
92
|
requirements:
|
|
93
93
|
- - "~>"
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 0.5.
|
|
95
|
+
version: 0.5.34
|
|
96
96
|
type: :runtime
|
|
97
97
|
prerelease: false
|
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
100
|
- - "~>"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: 0.5.
|
|
102
|
+
version: 0.5.34
|
|
103
103
|
- !ruby/object:Gem::Dependency
|
|
104
104
|
name: ostruct
|
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -208,6 +208,7 @@ files:
|
|
|
208
208
|
- docs/_guides/keyvalue-serialization.adoc
|
|
209
209
|
- docs/_guides/liquid-templates.adoc
|
|
210
210
|
- docs/_guides/missing-values-handling.adoc
|
|
211
|
+
- docs/_guides/native-engines.adoc
|
|
211
212
|
- docs/_guides/ooxml-examples.adoc
|
|
212
213
|
- docs/_guides/opal.adoc
|
|
213
214
|
- docs/_guides/rdf-serialization.adoc
|
|
@@ -320,6 +321,7 @@ files:
|
|
|
320
321
|
- lib/lutaml/json/adapter/oj_adapter.rb
|
|
321
322
|
- lib/lutaml/json/adapter/standard_adapter.rb
|
|
322
323
|
- lib/lutaml/json/adapter/transform.rb
|
|
324
|
+
- lib/lutaml/json/adapter/yeptris_adapter.rb
|
|
323
325
|
- lib/lutaml/json/format.rb
|
|
324
326
|
- lib/lutaml/json/generator_options.rb
|
|
325
327
|
- lib/lutaml/json/schema.rb
|
|
@@ -351,6 +353,7 @@ files:
|
|
|
351
353
|
- lib/lutaml/key_value/adapter/json/oj_adapter.rb
|
|
352
354
|
- lib/lutaml/key_value/adapter/json/standard_adapter.rb
|
|
353
355
|
- lib/lutaml/key_value/adapter/json/transform.rb
|
|
356
|
+
- lib/lutaml/key_value/adapter/json/yeptris_adapter.rb
|
|
354
357
|
- lib/lutaml/key_value/adapter/jsonl.rb
|
|
355
358
|
- lib/lutaml/key_value/adapter/jsonl/document.rb
|
|
356
359
|
- lib/lutaml/key_value/adapter/jsonl/mapping.rb
|
|
@@ -361,6 +364,7 @@ files:
|
|
|
361
364
|
- lib/lutaml/key_value/adapter/toml/document.rb
|
|
362
365
|
- lib/lutaml/key_value/adapter/toml/mapping.rb
|
|
363
366
|
- lib/lutaml/key_value/adapter/toml/mapping_rule.rb
|
|
367
|
+
- lib/lutaml/key_value/adapter/toml/teptris_adapter.rb
|
|
364
368
|
- lib/lutaml/key_value/adapter/toml/toml_rb_adapter.rb
|
|
365
369
|
- lib/lutaml/key_value/adapter/toml/tomlib_adapter.rb
|
|
366
370
|
- lib/lutaml/key_value/adapter/toml/transform.rb
|
|
@@ -370,6 +374,7 @@ files:
|
|
|
370
374
|
- lib/lutaml/key_value/adapter/yaml/mapping_rule.rb
|
|
371
375
|
- lib/lutaml/key_value/adapter/yaml/standard_adapter.rb
|
|
372
376
|
- lib/lutaml/key_value/adapter/yaml/transform.rb
|
|
377
|
+
- lib/lutaml/key_value/adapter/yaml/yeptris_adapter.rb
|
|
373
378
|
- lib/lutaml/key_value/adapter/yamls.rb
|
|
374
379
|
- lib/lutaml/key_value/adapter/yamls/document.rb
|
|
375
380
|
- lib/lutaml/key_value/adapter/yamls/mapping.rb
|
|
@@ -678,6 +683,7 @@ files:
|
|
|
678
683
|
- lib/lutaml/toml/adapter/document.rb
|
|
679
684
|
- lib/lutaml/toml/adapter/mapping.rb
|
|
680
685
|
- lib/lutaml/toml/adapter/mapping_rule.rb
|
|
686
|
+
- lib/lutaml/toml/adapter/teptris_adapter.rb
|
|
681
687
|
- lib/lutaml/toml/adapter/toml_rb_adapter.rb
|
|
682
688
|
- lib/lutaml/toml/adapter/tomlib_adapter.rb
|
|
683
689
|
- lib/lutaml/toml/adapter/transform.rb
|
|
@@ -691,6 +697,7 @@ files:
|
|
|
691
697
|
- lib/lutaml/xml/adapter.rb
|
|
692
698
|
- lib/lutaml/xml/adapter/adapter_helpers.rb
|
|
693
699
|
- lib/lutaml/xml/adapter/base_adapter.rb
|
|
700
|
+
- lib/lutaml/xml/adapter/leptris_adapter.rb
|
|
694
701
|
- lib/lutaml/xml/adapter/namespace_data.rb
|
|
695
702
|
- lib/lutaml/xml/adapter/namespace_uri_collector.rb
|
|
696
703
|
- lib/lutaml/xml/adapter/nokogiri_adapter.rb
|
|
@@ -707,6 +714,7 @@ files:
|
|
|
707
714
|
- lib/lutaml/xml/blank_namespace_handler.rb
|
|
708
715
|
- lib/lutaml/xml/builder.rb
|
|
709
716
|
- lib/lutaml/xml/builder/base.rb
|
|
717
|
+
- lib/lutaml/xml/builder/leptris.rb
|
|
710
718
|
- lib/lutaml/xml/builder/nokogiri.rb
|
|
711
719
|
- lib/lutaml/xml/builder/oga.rb
|
|
712
720
|
- lib/lutaml/xml/builder/ox.rb
|
|
@@ -753,6 +761,7 @@ files:
|
|
|
753
761
|
- lib/lutaml/xml/format.rb
|
|
754
762
|
- lib/lutaml/xml/format_chooser.rb
|
|
755
763
|
- lib/lutaml/xml/hoisting_algorithm.rb
|
|
764
|
+
- lib/lutaml/xml/leptris/element.rb
|
|
756
765
|
- lib/lutaml/xml/listener.rb
|
|
757
766
|
- lib/lutaml/xml/mapping.rb
|
|
758
767
|
- lib/lutaml/xml/mapping_rule.rb
|
|
@@ -780,6 +789,8 @@ files:
|
|
|
780
789
|
- lib/lutaml/xml/parse_session.rb
|
|
781
790
|
- lib/lutaml/xml/parsed_namespace_declaration.rb
|
|
782
791
|
- lib/lutaml/xml/parsed_namespace_set.rb
|
|
792
|
+
- lib/lutaml/xml/plan_compiler.rb
|
|
793
|
+
- lib/lutaml/xml/plan_hydrator.rb
|
|
783
794
|
- lib/lutaml/xml/polymorphic_value_handler.rb
|
|
784
795
|
- lib/lutaml/xml/qualified_inheritance_strategy.rb
|
|
785
796
|
- lib/lutaml/xml/rexml.rb
|
|
@@ -904,6 +915,7 @@ files:
|
|
|
904
915
|
- lib/lutaml/yaml/adapter/mapping_rule.rb
|
|
905
916
|
- lib/lutaml/yaml/adapter/standard_adapter.rb
|
|
906
917
|
- lib/lutaml/yaml/adapter/transform.rb
|
|
918
|
+
- lib/lutaml/yaml/adapter/yeptris_adapter.rb
|
|
907
919
|
- lib/lutaml/yaml/format.rb
|
|
908
920
|
- lib/lutaml/yaml/schema.rb
|
|
909
921
|
- lib/lutaml/yaml/schema/yaml_schema.rb
|
|
@@ -926,6 +938,9 @@ files:
|
|
|
926
938
|
- lib/tasks/performance_benchmark.rb
|
|
927
939
|
- lib/tasks/performance_comparator.rb
|
|
928
940
|
- lib/tasks/performance_helpers.rb
|
|
941
|
+
- lib/tasks/performance_probe.rake
|
|
942
|
+
- lib/tasks/performance_probe.rb
|
|
943
|
+
- lib/tasks/performance_probe_xml.rb
|
|
929
944
|
- lib/tasks/xml_compiler_benchmark.rb
|
|
930
945
|
- lib/tasks/xml_optimization_benchmark.rb
|
|
931
946
|
- lutaml-model.gemspec
|
|
@@ -1640,7 +1655,9 @@ files:
|
|
|
1640
1655
|
- spec/lutaml/integration/multi_format_spec.rb
|
|
1641
1656
|
- spec/lutaml/integration/round_trip_spec.rb
|
|
1642
1657
|
- spec/lutaml/json/adapter/standard_adapter_spec.rb
|
|
1658
|
+
- spec/lutaml/json/yeptris_adapter_spec.rb
|
|
1643
1659
|
- spec/lutaml/jsonld/adapter_spec.rb
|
|
1660
|
+
- spec/lutaml/key_value/adapter/toml/teptris_adapter_spec.rb
|
|
1644
1661
|
- spec/lutaml/key_value/transformation/collection_serializer_spec.rb
|
|
1645
1662
|
- spec/lutaml/key_value/transformation/rule_compiler_spec.rb
|
|
1646
1663
|
- spec/lutaml/key_value/transformation/value_serializer_spec.rb
|
|
@@ -1893,6 +1910,7 @@ files:
|
|
|
1893
1910
|
- spec/lutaml/xml/ordered_method_spec.rb
|
|
1894
1911
|
- spec/lutaml/xml/out_of_namespace_parsing_spec.rb
|
|
1895
1912
|
- spec/lutaml/xml/pipeline_integration_spec.rb
|
|
1913
|
+
- spec/lutaml/xml/plan_fast_path_spec.rb
|
|
1896
1914
|
- spec/lutaml/xml/prefix_control_spec.rb
|
|
1897
1915
|
- spec/lutaml/xml/register_spec.rb
|
|
1898
1916
|
- spec/lutaml/xml/reusable_mapping_spec.rb
|
|
@@ -1942,6 +1960,7 @@ files:
|
|
|
1942
1960
|
- spec/lutaml/xml/xml_space_spec.rb
|
|
1943
1961
|
- spec/lutaml/xml/xml_space_type_spec.rb
|
|
1944
1962
|
- spec/lutaml/xml/xml_spec.rb
|
|
1963
|
+
- spec/lutaml/yaml/yeptris_adapter_spec.rb
|
|
1945
1964
|
- spec/lutaml/yamlld/adapter_spec.rb
|
|
1946
1965
|
- spec/lutaml/yamlld/registration_spec.rb
|
|
1947
1966
|
- spec/parent_root_spec.rb
|