lutaml-model 0.8.23 → 0.8.28
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 +5 -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/compiled_rule.rb +16 -0
- 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 +65 -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/declaration_planner.rb +8 -2
- data/lib/lutaml/xml/format.rb +7 -1
- data/lib/lutaml/xml/leptris/element.rb +34 -0
- data/lib/lutaml/xml/namespace_collector.rb +4 -3
- data/lib/lutaml/xml/plan_compiler.rb +253 -0
- data/lib/lutaml/xml/plan_hydrator.rb +341 -0
- data/lib/lutaml/xml/plan_order.rb +50 -0
- data/lib/lutaml/xml/plan_serializer.rb +241 -0
- data/lib/lutaml/xml/plan_walk.rb +30 -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 +46 -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_plan_walk.rb +58 -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 +547 -0
- data/spec/lutaml/xml/plan_walk_spec.rb +102 -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 +28 -4
|
@@ -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.28
|
|
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-17 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.56
|
|
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.56
|
|
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,11 @@ 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
|
|
794
|
+
- lib/lutaml/xml/plan_order.rb
|
|
795
|
+
- lib/lutaml/xml/plan_serializer.rb
|
|
796
|
+
- lib/lutaml/xml/plan_walk.rb
|
|
783
797
|
- lib/lutaml/xml/polymorphic_value_handler.rb
|
|
784
798
|
- lib/lutaml/xml/qualified_inheritance_strategy.rb
|
|
785
799
|
- lib/lutaml/xml/rexml.rb
|
|
@@ -904,6 +918,7 @@ files:
|
|
|
904
918
|
- lib/lutaml/yaml/adapter/mapping_rule.rb
|
|
905
919
|
- lib/lutaml/yaml/adapter/standard_adapter.rb
|
|
906
920
|
- lib/lutaml/yaml/adapter/transform.rb
|
|
921
|
+
- lib/lutaml/yaml/adapter/yeptris_adapter.rb
|
|
907
922
|
- lib/lutaml/yaml/format.rb
|
|
908
923
|
- lib/lutaml/yaml/schema.rb
|
|
909
924
|
- lib/lutaml/yaml/schema/yaml_schema.rb
|
|
@@ -926,6 +941,10 @@ files:
|
|
|
926
941
|
- lib/tasks/performance_benchmark.rb
|
|
927
942
|
- lib/tasks/performance_comparator.rb
|
|
928
943
|
- lib/tasks/performance_helpers.rb
|
|
944
|
+
- lib/tasks/performance_probe.rake
|
|
945
|
+
- lib/tasks/performance_probe.rb
|
|
946
|
+
- lib/tasks/performance_probe_plan_walk.rb
|
|
947
|
+
- lib/tasks/performance_probe_xml.rb
|
|
929
948
|
- lib/tasks/xml_compiler_benchmark.rb
|
|
930
949
|
- lib/tasks/xml_optimization_benchmark.rb
|
|
931
950
|
- lutaml-model.gemspec
|
|
@@ -1640,7 +1659,9 @@ files:
|
|
|
1640
1659
|
- spec/lutaml/integration/multi_format_spec.rb
|
|
1641
1660
|
- spec/lutaml/integration/round_trip_spec.rb
|
|
1642
1661
|
- spec/lutaml/json/adapter/standard_adapter_spec.rb
|
|
1662
|
+
- spec/lutaml/json/yeptris_adapter_spec.rb
|
|
1643
1663
|
- spec/lutaml/jsonld/adapter_spec.rb
|
|
1664
|
+
- spec/lutaml/key_value/adapter/toml/teptris_adapter_spec.rb
|
|
1644
1665
|
- spec/lutaml/key_value/transformation/collection_serializer_spec.rb
|
|
1645
1666
|
- spec/lutaml/key_value/transformation/rule_compiler_spec.rb
|
|
1646
1667
|
- spec/lutaml/key_value/transformation/value_serializer_spec.rb
|
|
@@ -1893,6 +1914,8 @@ files:
|
|
|
1893
1914
|
- spec/lutaml/xml/ordered_method_spec.rb
|
|
1894
1915
|
- spec/lutaml/xml/out_of_namespace_parsing_spec.rb
|
|
1895
1916
|
- spec/lutaml/xml/pipeline_integration_spec.rb
|
|
1917
|
+
- spec/lutaml/xml/plan_fast_path_spec.rb
|
|
1918
|
+
- spec/lutaml/xml/plan_walk_spec.rb
|
|
1896
1919
|
- spec/lutaml/xml/prefix_control_spec.rb
|
|
1897
1920
|
- spec/lutaml/xml/register_spec.rb
|
|
1898
1921
|
- spec/lutaml/xml/reusable_mapping_spec.rb
|
|
@@ -1942,6 +1965,7 @@ files:
|
|
|
1942
1965
|
- spec/lutaml/xml/xml_space_spec.rb
|
|
1943
1966
|
- spec/lutaml/xml/xml_space_type_spec.rb
|
|
1944
1967
|
- spec/lutaml/xml/xml_spec.rb
|
|
1968
|
+
- spec/lutaml/yaml/yeptris_adapter_spec.rb
|
|
1945
1969
|
- spec/lutaml/yamlld/adapter_spec.rb
|
|
1946
1970
|
- spec/lutaml/yamlld/registration_spec.rb
|
|
1947
1971
|
- spec/parent_root_spec.rb
|