lutaml-model 0.8.201 → 0.8.202
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/scripts/test_installed_gem.rb +1 -13
- data/.github/workflows/downstream-performance.yml +1 -22
- data/.github/workflows/performance.yml +1 -33
- data/.github/workflows/rake.yml +2 -6
- data/.rubocop.yml +0 -10
- data/.rubocop_todo.yml +0 -4
- data/Gemfile +0 -23
- data/README.adoc +25 -86
- data/Rakefile +2 -167
- data/docs/_guides/advanced-mapping.adoc +6 -6
- data/docs/_guides/character-encoding.adoc +0 -3
- data/docs/_guides/gem-integration.adoc +1 -1
- data/docs/_guides/index.adoc +0 -4
- data/docs/_guides/xml/type-namespaces.adoc +1 -1
- data/docs/_guides/xml-guide-0.8.0.adoc +2 -2
- data/docs/_guides/xml-namespaces.adoc +2 -3
- data/docs/_guides/xml_mappings/03_architecture.adoc +2 -2
- data/docs/_guides/xml_mappings/07_best_practices.adoc +2 -3
- data/docs/_guides/xml_mappings/08_troubleshooting.adoc +1 -9
- data/docs/_pages/comparison-with-shale.adoc +1 -1
- data/docs/_pages/configuration.adoc +6 -40
- data/docs/_pages/index.adoc +0 -1
- data/docs/_pages/serialization_adapters.adoc +4 -16
- data/docs/_references/architecture.adoc +1 -1
- data/docs/_references/lutaml-namespace-planning.md +1 -1
- data/docs/_references/three-phase-namespace-architecture.adoc +1 -2
- data/docs/_references/xsd-generation-with-namespace-support.adoc +3 -8
- data/docs/_tutorials/lutaml-xml-architecture.adoc +2 -8
- data/docs/architecture.md +7 -11
- data/docs/conversion_caching.adoc +1 -1
- data/docs/index.adoc +0 -1
- data/docs/key_value_data_model.adoc +1 -1
- data/docs/namespace-management.adoc +4 -10
- data/lib/lutaml/json/format.rb +0 -1
- data/lib/lutaml/json/generator_options.rb +0 -1
- data/lib/lutaml/key_value/transform.rb +9 -16
- data/lib/lutaml/lml/document_builder.rb +2 -2
- data/lib/lutaml/lml/entity_types.rb +2 -2
- data/lib/lutaml/model/adapter_resolver.rb +5 -15
- data/lib/lutaml/model/cached_type_resolver.rb +1 -7
- data/lib/lutaml/model/error/unknown_adapter_type_error.rb +1 -1
- data/lib/lutaml/model/global_context.rb +3 -5
- data/lib/lutaml/model/instrumentation.rb +0 -3
- data/lib/lutaml/model/mapping/mapping_rule.rb +6 -10
- data/lib/lutaml/model/register.rb +20 -31
- data/lib/lutaml/model/runtime_compatibility.rb +0 -92
- data/lib/lutaml/model/schema/class_loader.rb +2 -4
- data/lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb +2 -3
- data/lib/lutaml/model/serialize/attribute_definition.rb +10 -184
- data/lib/lutaml/model/serialize/conversion_caching.rb +1 -5
- data/lib/lutaml/model/serialize/model_import.rb +0 -5
- data/lib/lutaml/model/serialize/value_mapping.rb +0 -3
- data/lib/lutaml/model/services/rule_value_extractor.rb +4 -7
- data/lib/lutaml/model/store.rb +10 -17
- data/lib/lutaml/model/toml.rb +0 -2
- data/lib/lutaml/model/transformation_registry.rb +3 -7
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/model.rb +3 -19
- data/lib/lutaml/toml/format.rb +4 -8
- data/lib/lutaml/xml/adapter/moxml_adapter.rb +1 -7
- data/lib/lutaml/xml/adapter.rb +0 -4
- data/lib/lutaml/xml/adapter_loader.rb +1 -6
- data/lib/lutaml/xml/builder/base.rb +0 -3
- data/lib/lutaml/xml/builder.rb +0 -8
- data/lib/lutaml/xml/data_model.rb +1 -1
- data/lib/lutaml/xml/doctype_extractor.rb +3 -3
- data/lib/lutaml/xml/format.rb +22 -74
- data/lib/lutaml/xml/leptris/plan_compiler.rb +1 -2
- data/lib/lutaml/xml/model_transform.rb +14 -24
- data/lib/lutaml/xml/polymorphic_value_handler.rb +1 -1
- data/lib/lutaml/xml/schema/builder/moxml.rb +1 -1
- data/lib/lutaml/xml/schema/builder.rb +6 -9
- data/lib/lutaml/xml/schema/relaxng_schema.rb +1 -1
- data/lib/lutaml/xml/xml_element.rb +3 -2
- data/lib/lutaml/xml/xsd_validator.rb +4 -11
- data/lib/lutaml/yaml/adapter/yeptris_adapter.rb +2 -2
- data/lib/lutaml/yamls/adapter_loader.rb +1 -5
- data/lib/tasks/performance_comparator.rb +1 -1
- data/lutaml-model.gemspec +3 -8
- data/spec/benchmarks/xml_parsing_benchmark_spec.rb +1 -1
- data/spec/lutaml/json/adapter/standard_adapter_spec.rb +6 -9
- data/spec/lutaml/model/adapter_resolver_yeptris_switch_spec.rb +0 -2
- data/spec/lutaml/model/cached_type_resolver_spec.rb +2 -54
- data/spec/lutaml/model/cdata_spec.rb +2 -15
- data/spec/lutaml/model/encoding_spec.rb +0 -9
- data/spec/lutaml/model/except_spec.rb +0 -7
- data/spec/lutaml/model/json_spec.rb +0 -14
- data/spec/lutaml/model/mixed_content_spec.rb +6 -46
- data/spec/lutaml/model/ordered_content_spec.rb +0 -7
- data/spec/lutaml/model/processing_instruction_spec.rb +0 -6
- data/spec/lutaml/model/runtime_compatibility_spec.rb +0 -37
- data/spec/lutaml/model/serializable_spec.rb +0 -2
- data/spec/lutaml/model/toml_spec.rb +0 -23
- data/spec/lutaml/xml/adapter/base_adapter_regression_spec.rb +0 -4
- data/spec/lutaml/xml/adapter/order_spec.rb +1 -1
- data/spec/lutaml/xml/adapter/xml_namespace_spec.rb +0 -7
- data/spec/lutaml/xml/attribute_namespace_disjointness_spec.rb +6 -6
- data/spec/lutaml/xml/builder/builder_spec.rb +0 -24
- data/spec/lutaml/xml/default_namespace_spec.rb +1 -8
- data/spec/lutaml/xml/doctype_preservation_spec.rb +0 -4
- data/spec/lutaml/xml/entity_fragmentation_spec.rb +0 -6
- data/spec/lutaml/xml/fpi_namespace_spec.rb +0 -21
- data/spec/lutaml/xml/mapping_spec.rb +8 -15
- data/spec/lutaml/xml/namespace_scope_vcard_spec.rb +0 -7
- data/spec/lutaml/xml/namespace_spec.rb +0 -13
- data/spec/lutaml/xml/prefix_control_spec.rb +0 -6
- data/spec/lutaml/xml/schema/builder_moxml_spec.rb +1 -1
- data/spec/lutaml/xml/xml_adapter_spec.rb +0 -7
- data/spec/lutaml/xml/xml_spec.rb +2 -88
- data/spec/spec_helper.rb +5 -24
- data/spec/support/test_adapter_config.rb +6 -6
- metadata +1 -32
- data/.github/workflows/js-pr-check.yml +0 -106
- data/.github/workflows/js-sync.yml +0 -55
- data/.github/workflows/opal.yml +0 -65
- data/.gitmodules +0 -6
- data/.rspec-opal +0 -5
- data/docs/_guides/opal.adoc +0 -232
- data/lib/compat/opal/generate_boot.rb +0 -137
- data/lib/compat/opal/js_bundle_entry.rb +0 -42
- data/lib/compat/opal/lutaml_model_boot.rb +0 -638
- data/lib/compat/opal/monitor.rb +0 -31
- data/lib/compat/opal/moxml/adapter/customized_rexml/entity_reference.rb +0 -9
- data/lib/compat/opal/moxml/adapter/customized_rexml/formatter.rb +0 -225
- data/lib/compat/opal/moxml/adapter/customized_rexml.rb +0 -11
- data/lib/compat/opal/moxml_boot.rb +0 -68
- data/lib/compat/opal/objectspace_shim.rb +0 -23
- data/lib/compat/opal/rexml/namespace.rb +0 -59
- data/lib/compat/opal/rexml/parsers/baseparser.rb +0 -1016
- data/lib/compat/opal/rexml/source.rb +0 -214
- data/lib/compat/opal/rexml/text.rb +0 -426
- data/lib/compat/opal/rexml/xmltokens.rb +0 -45
- data/lib/compat/opal/rexml_compat.rb +0 -85
- data/lib/compat/opal/yaml_compat.rb +0 -32
- data/lib/lutaml/model/cached_type_resolver/mutex_hash_cache.rb +0 -53
- data/lib/lutaml/model/schema/schema_builder/oga.rb +0 -92
- data/lib/lutaml/xml/schema/builder/oga.rb +0 -92
- data/spec/lutaml/model/boot_manifest_spec.rb +0 -30
- data/spec/lutaml/model/opal_smoke_spec.rb +0 -199
- data/spec/lutaml/model/serialize/attribute_definition_block_form_spec.rb +0 -244
- data/spec/lutaml/xml/adapter/oga_adapter_spec.rb +0 -135
- data/spec/lutaml/xml/opal_xml_spec.rb +0 -204
- data/spec/support/opal.rb +0 -9
|
@@ -95,7 +95,7 @@ RSpec.describe DefaultNamespaceSpec do
|
|
|
95
95
|
# and namespace has element_form_default: :unqualified (W3C default),
|
|
96
96
|
# so child is in BLANK namespace and MUST declare xmlns="".
|
|
97
97
|
#
|
|
98
|
-
# All adapters (Nokogiri, Ox
|
|
98
|
+
# All adapters (Nokogiri, Ox) now correctly add xmlns=""
|
|
99
99
|
# to explicitly place child in blank namespace.
|
|
100
100
|
expect(xml).to include('xmlns="http://example.com/ns"')
|
|
101
101
|
expect(xml).to include('<child xmlns="">Content</child>')
|
|
@@ -179,11 +179,4 @@ RSpec.describe DefaultNamespaceSpec do
|
|
|
179
179
|
described_class
|
|
180
180
|
end
|
|
181
181
|
end
|
|
182
|
-
|
|
183
|
-
describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga) do
|
|
184
|
-
if TestAdapterConfig.adapter_enabled?(:oga)
|
|
185
|
-
it_behaves_like "default namespace serialization",
|
|
186
|
-
described_class
|
|
187
|
-
end
|
|
188
|
-
end
|
|
189
182
|
end
|
|
@@ -563,12 +563,6 @@ RSpec.describe "XML Entity Fragmentation Issue #5" do
|
|
|
563
563
|
end
|
|
564
564
|
end
|
|
565
565
|
|
|
566
|
-
describe "with Oga adapter" do
|
|
567
|
-
if TestAdapterConfig.adapter_enabled?(:oga)
|
|
568
|
-
it_behaves_like "XML entity preservation", :oga
|
|
569
|
-
end
|
|
570
|
-
end
|
|
571
|
-
|
|
572
566
|
describe "with Ox adapter" do
|
|
573
567
|
if TestAdapterConfig.adapter_enabled?(:ox)
|
|
574
568
|
it_behaves_like "XML entity preservation", :ox
|
|
@@ -69,27 +69,6 @@ RSpec.describe "FPI Namespace Handling" do
|
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
context "with Oga adapter" do
|
|
73
|
-
before(:all) do
|
|
74
|
-
Lutaml::Model::Config.xml_adapter_type = :oga
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
it "converts FPI namespace to URN on serialization" do
|
|
78
|
-
xml = <<~XML
|
|
79
|
-
<table xmlns="-//OASIS//DTD XML Exchange Table Model 19990315//EN">
|
|
80
|
-
<entry>Data</entry>
|
|
81
|
-
</table>
|
|
82
|
-
XML
|
|
83
|
-
|
|
84
|
-
adapter_class = Lutaml::Model::Config.xml_adapter
|
|
85
|
-
doc = adapter_class.parse(xml)
|
|
86
|
-
|
|
87
|
-
output = doc.to_xml
|
|
88
|
-
|
|
89
|
-
expect(output).to include("urn:publicid:-//OASIS//DTD+XML+Exchange+Table+Model+19990315//EN")
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
72
|
context "helper methods in BaseAdapter" do
|
|
94
73
|
before(:all) do
|
|
95
74
|
# Use any adapter to test the class methods
|
|
@@ -624,7 +624,7 @@ RSpec.describe Lutaml::Xml::Mapping do
|
|
|
624
624
|
serialized = parsed.to_xml
|
|
625
625
|
|
|
626
626
|
# Different adapters have different hoisting behaviors:
|
|
627
|
-
# - Nokogiri
|
|
627
|
+
# - Nokogiri: Hoists namespace to parent
|
|
628
628
|
# - Ox: No namespace declaration (uses inline xmi prefix without xmlns)
|
|
629
629
|
expected = if adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox)
|
|
630
630
|
# Ox doesn't add xmlns declaration when model has no namespace
|
|
@@ -634,7 +634,7 @@ RSpec.describe Lutaml::Xml::Mapping do
|
|
|
634
634
|
</ownedComment>
|
|
635
635
|
XML
|
|
636
636
|
else
|
|
637
|
-
# Nokogiri
|
|
637
|
+
# Nokogiri hoists the namespace
|
|
638
638
|
xml_with_element_hoisted.strip
|
|
639
639
|
end
|
|
640
640
|
expect(serialized).to be_xml_equivalent_to(expected)
|
|
@@ -653,7 +653,7 @@ RSpec.describe Lutaml::Xml::Mapping do
|
|
|
653
653
|
serialized = parsed.to_xml
|
|
654
654
|
|
|
655
655
|
# Different adapters have different hoisting behaviors:
|
|
656
|
-
# - Nokogiri
|
|
656
|
+
# - Nokogiri: Hoists namespace to parent
|
|
657
657
|
# - Ox: No namespace declaration (uses inline xmi prefix without xmlns)
|
|
658
658
|
expected = if adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox)
|
|
659
659
|
# Ox doesn't add xmlns declaration when model has no namespace
|
|
@@ -663,7 +663,7 @@ RSpec.describe Lutaml::Xml::Mapping do
|
|
|
663
663
|
</ownedComment>
|
|
664
664
|
XML
|
|
665
665
|
else
|
|
666
|
-
# Nokogiri
|
|
666
|
+
# Nokogiri hoists the namespace
|
|
667
667
|
xml_with_same_name_attribute_and_element_hoisted
|
|
668
668
|
end
|
|
669
669
|
expect(serialized).to be_xml_equivalent_to(expected)
|
|
@@ -704,7 +704,7 @@ RSpec.describe Lutaml::Xml::Mapping do
|
|
|
704
704
|
</SameElementName>
|
|
705
705
|
XML
|
|
706
706
|
else
|
|
707
|
-
# Nokogiri
|
|
707
|
+
# Nokogiri: CityGML preserves PREFIX format, GML uses DEFAULT
|
|
708
708
|
<<~XML
|
|
709
709
|
<SameElementName xmlns="http://www.omg.org/spec/XMI/20131001" App="hello">
|
|
710
710
|
<ApplicationSchema xmlns="http://www.sparxsystems.com/profiles/GML/1.0">GML App</ApplicationSchema>
|
|
@@ -801,7 +801,7 @@ RSpec.describe Lutaml::Xml::Mapping do
|
|
|
801
801
|
it "reads element without namespace" do
|
|
802
802
|
# NOTE: mapping with namespace: nil, prefix: nil has differing adapter behavior:
|
|
803
803
|
# - Nokogiri: Cannot parse element with parent namespace prefix, returns nil
|
|
804
|
-
# - Ox
|
|
804
|
+
# - Ox: Can parse element with parent namespace prefix successfully
|
|
805
805
|
if adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:nokogiri)
|
|
806
806
|
expect(parsed.without_namespace).to be_nil
|
|
807
807
|
else
|
|
@@ -820,7 +820,7 @@ RSpec.describe Lutaml::Xml::Mapping do
|
|
|
820
820
|
expect(reparsed.with_default_namespace).to eq("default namespace text")
|
|
821
821
|
expect(reparsed.with_namespace.value).to eq("explicit namespace text")
|
|
822
822
|
else
|
|
823
|
-
# Ox
|
|
823
|
+
# Ox can parse the element successfully
|
|
824
824
|
# When parent has element_form_default: :qualified (ParentNamespace has this),
|
|
825
825
|
# children without explicit namespace inherit parent's namespace.
|
|
826
826
|
# WithoutNamespaceElement has no namespace declaration, so it inherits.
|
|
@@ -917,7 +917,7 @@ RSpec.describe Lutaml::Xml::Mapping do
|
|
|
917
917
|
# instead of prefix format for child elements with different namespaces.
|
|
918
918
|
# Both are W3C compliant.
|
|
919
919
|
let(:expected_xml) do
|
|
920
|
-
# Ox uses prefix format, Nokogiri
|
|
920
|
+
# Ox uses prefix format, Nokogiri uses default format
|
|
921
921
|
if adapter_class == Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:ox)
|
|
922
922
|
<<~XML
|
|
923
923
|
<ChildNamespaceNil xmlns="http://www.omg.org/spec/XMI/20131001">
|
|
@@ -1134,13 +1134,6 @@ RSpec.describe Lutaml::Xml::Mapping do
|
|
|
1134
1134
|
end
|
|
1135
1135
|
end
|
|
1136
1136
|
|
|
1137
|
-
describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga) do
|
|
1138
|
-
if TestAdapterConfig.adapter_enabled?(:oga)
|
|
1139
|
-
it_behaves_like "having XML Mappings",
|
|
1140
|
-
described_class
|
|
1141
|
-
end
|
|
1142
|
-
end
|
|
1143
|
-
|
|
1144
1137
|
describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:rexml) do
|
|
1145
1138
|
if TestAdapterConfig.adapter_enabled?(:rexml)
|
|
1146
1139
|
it_behaves_like "having XML Mappings", described_class
|
|
@@ -597,13 +597,6 @@ RSpec.describe "namespace_scope with vCard" do
|
|
|
597
597
|
end
|
|
598
598
|
end
|
|
599
599
|
|
|
600
|
-
context "with Oga adapter" do
|
|
601
|
-
if TestAdapterConfig.adapter_enabled?(:oga)
|
|
602
|
-
it_behaves_like "namespace_scope behavior",
|
|
603
|
-
Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga)
|
|
604
|
-
end
|
|
605
|
-
end
|
|
606
|
-
|
|
607
600
|
context "with REXML adapter" do
|
|
608
601
|
if TestAdapterConfig.adapter_enabled?(:rexml)
|
|
609
602
|
it_behaves_like "namespace_scope behavior",
|
|
@@ -685,19 +685,6 @@ RSpec.describe "XML Namespace Handling" do
|
|
|
685
685
|
it_behaves_like "namespace inheritance behavior"
|
|
686
686
|
end
|
|
687
687
|
|
|
688
|
-
describe "with Oga adapter" do
|
|
689
|
-
around do |example|
|
|
690
|
-
Lutaml::Model::Config.xml_adapter_type = :oga
|
|
691
|
-
example.run
|
|
692
|
-
end
|
|
693
|
-
|
|
694
|
-
after(:all) do
|
|
695
|
-
Lutaml::Model::Config.xml_adapter_type = :nokogiri
|
|
696
|
-
end
|
|
697
|
-
|
|
698
|
-
it_behaves_like "namespace inheritance behavior"
|
|
699
|
-
end
|
|
700
|
-
|
|
701
688
|
describe "with REXML adapter" do
|
|
702
689
|
if TestAdapterConfig.adapter_enabled?(:rexml)
|
|
703
690
|
around do |example|
|
|
@@ -268,12 +268,6 @@ RSpec.describe "XML Prefix Control" do
|
|
|
268
268
|
end
|
|
269
269
|
end
|
|
270
270
|
|
|
271
|
-
context "with Oga adapter" do
|
|
272
|
-
if TestAdapterConfig.adapter_enabled?(:oga)
|
|
273
|
-
it_behaves_like "prefix control behavior", Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga)
|
|
274
|
-
end
|
|
275
|
-
end
|
|
276
|
-
|
|
277
271
|
context "with REXML adapter" do
|
|
278
272
|
if TestAdapterConfig.adapter_enabled?(:rexml)
|
|
279
273
|
it_behaves_like "prefix control behavior",
|
|
@@ -4,7 +4,7 @@ require "spec_helper"
|
|
|
4
4
|
|
|
5
5
|
RSpec.describe Lutaml::Xml::Schema::Builder do
|
|
6
6
|
# issue #1184: schema generation rides the CONFIGURED engine through
|
|
7
|
-
# the moxml layer. The dedicated Nokogiri
|
|
7
|
+
# the moxml layer. The dedicated Nokogiri wrapper keeps its
|
|
8
8
|
# lanes; every other engine (ox, leptris, rexml) generates through
|
|
9
9
|
# the Moxml wrapper instead of silently substituting Nokogiri.
|
|
10
10
|
|
|
@@ -238,13 +238,6 @@ RSpec.describe "XmlAdapter" do
|
|
|
238
238
|
end
|
|
239
239
|
end
|
|
240
240
|
|
|
241
|
-
describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:oga) do
|
|
242
|
-
if TestAdapterConfig.adapter_enabled?(:oga)
|
|
243
|
-
it_behaves_like "an XML adapter",
|
|
244
|
-
described_class
|
|
245
|
-
end
|
|
246
|
-
end
|
|
247
|
-
|
|
248
241
|
describe Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(:rexml) do
|
|
249
242
|
if TestAdapterConfig.adapter_enabled?(:rexml)
|
|
250
243
|
it_behaves_like "an XML adapter",
|
data/spec/lutaml/xml/xml_spec.rb
CHANGED
|
@@ -34,82 +34,8 @@ RSpec.describe Lutaml::Xml do
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe "schema autoloads" do
|
|
37
|
-
it "
|
|
38
|
-
expect(described_class::Schema.const_defined?(:Xsd, false))
|
|
39
|
-
.to be(!Lutaml::Model::RuntimeCompatibility.opal?)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "does not autoload schema constants when loaded under Opal" do
|
|
43
|
-
script = <<~'RUBY'
|
|
44
|
-
require "lutaml/model/runtime_compatibility"
|
|
45
|
-
|
|
46
|
-
module Lutaml
|
|
47
|
-
module Model
|
|
48
|
-
module RuntimeCompatibility
|
|
49
|
-
def self.opal?
|
|
50
|
-
true
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
require "lutaml/xml/schema"
|
|
57
|
-
|
|
58
|
-
schema_constants = %i[
|
|
59
|
-
Xsd XsdSchema RelaxngSchema Builder BuiltinTypes
|
|
60
|
-
]
|
|
61
|
-
|
|
62
|
-
loaded_constants = schema_constants.select do |constant_name|
|
|
63
|
-
Lutaml::Xml::Schema.autoload?(constant_name) ||
|
|
64
|
-
Lutaml::Xml::Schema.const_defined?(constant_name, false)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
if loaded_constants.any?
|
|
68
|
-
abort "loaded schema constants: #{loaded_constants.join(', ')}"
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
puts :ok
|
|
72
|
-
RUBY
|
|
73
|
-
|
|
74
|
-
result, status = run_ruby(script)
|
|
75
|
-
|
|
76
|
-
expect(status.success?).to be(true), result
|
|
77
|
-
expect(result).to include("ok")
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
describe "schema methods" do
|
|
82
|
-
before do
|
|
83
|
-
allow(Lutaml::Model::RuntimeCompatibility).to receive(:opal?)
|
|
84
|
-
.and_return(true)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
it "raises NotImplementedError for XSD generation under Opal" do
|
|
88
|
-
expect do
|
|
89
|
-
Lutaml::Model::Schema.to_xsd(Object)
|
|
90
|
-
end.to raise_error(
|
|
91
|
-
NotImplementedError,
|
|
92
|
-
"XSD schema generation is not available under Opal.",
|
|
93
|
-
)
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
it "raises NotImplementedError for RELAX NG generation under Opal" do
|
|
97
|
-
expect do
|
|
98
|
-
Lutaml::Model::Schema.to_relaxng(Object)
|
|
99
|
-
end.to raise_error(
|
|
100
|
-
NotImplementedError,
|
|
101
|
-
"RELAX NG schema generation requires Nokogiri, " \
|
|
102
|
-
"which is not available under Opal.",
|
|
103
|
-
)
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
it "raises NotImplementedError for XML schema compilation under Opal" do
|
|
107
|
-
expect do
|
|
108
|
-
Lutaml::Model::Schema.from_xml("<schema/>")
|
|
109
|
-
end.to raise_error(
|
|
110
|
-
NotImplementedError,
|
|
111
|
-
"XML schema compilation is not available under Opal.",
|
|
112
|
-
)
|
|
37
|
+
it "registers the schema constant autoloads" do
|
|
38
|
+
expect(described_class::Schema.const_defined?(:Xsd, false)).to be(true)
|
|
113
39
|
end
|
|
114
40
|
end
|
|
115
41
|
|
|
@@ -118,7 +44,6 @@ RSpec.describe Lutaml::Xml do
|
|
|
118
44
|
# Hide any existing constants first
|
|
119
45
|
hide_const("Nokogiri") if Object.const_defined?(:Nokogiri)
|
|
120
46
|
hide_const("Ox") if Object.const_defined?(:Ox)
|
|
121
|
-
hide_const("Oga") if Object.const_defined?(:Oga)
|
|
122
47
|
hide_const("REXML") if Object.const_defined?(:REXML)
|
|
123
48
|
# When the leptris gem is in the bundle, moxml prefers it over every
|
|
124
49
|
# other engine; the legacy-detection contexts below must opt out to
|
|
@@ -155,16 +80,6 @@ RSpec.describe Lutaml::Xml do
|
|
|
155
80
|
end
|
|
156
81
|
end
|
|
157
82
|
|
|
158
|
-
context "when Oga is available" do
|
|
159
|
-
before do
|
|
160
|
-
stub_const("Oga", Module.new)
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
it "returns :oga" do
|
|
164
|
-
expect(described_class.detect_xml_adapter).to eq(:oga)
|
|
165
|
-
end
|
|
166
|
-
end
|
|
167
|
-
|
|
168
83
|
context "when no adapters are detected" do
|
|
169
84
|
it "falls back to moxml default (:nokogiri)" do
|
|
170
85
|
expect(described_class.detect_xml_adapter).to eq(:nokogiri)
|
|
@@ -175,7 +90,6 @@ RSpec.describe Lutaml::Xml do
|
|
|
175
90
|
before do
|
|
176
91
|
stub_const("Nokogiri", Module.new)
|
|
177
92
|
stub_const("Ox", Module.new)
|
|
178
|
-
stub_const("Oga", Module.new)
|
|
179
93
|
end
|
|
180
94
|
|
|
181
95
|
it "prefers Nokogiri" do
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "liquid"
|
|
3
|
+
require "liquid"
|
|
4
4
|
require "rspec/matchers"
|
|
5
|
-
require "canon"
|
|
5
|
+
require "canon"
|
|
6
6
|
|
|
7
7
|
RSpec.configure do |config|
|
|
8
8
|
# Enable flags like --only-failures and --next-failure
|
|
@@ -86,22 +86,6 @@ RSpec.configure do |config|
|
|
|
86
86
|
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
|
-
|
|
90
|
-
# Under Opal, exclude specs that require native-only adapters,
|
|
91
|
-
# filesystem, subprocess, schema compilation, or liquid templates.
|
|
92
|
-
if RUBY_ENGINE == "opal"
|
|
93
|
-
config.filter_run_excluding(
|
|
94
|
-
:native_adapter,
|
|
95
|
-
:native_fs,
|
|
96
|
-
:subprocess,
|
|
97
|
-
:performance,
|
|
98
|
-
:examples,
|
|
99
|
-
:consistency,
|
|
100
|
-
:xsd_schema,
|
|
101
|
-
:relaxng,
|
|
102
|
-
:liquid,
|
|
103
|
-
)
|
|
104
|
-
end
|
|
105
89
|
end
|
|
106
90
|
|
|
107
91
|
# configuration example
|
|
@@ -114,9 +98,7 @@ require_relative "support/test_adapter_config"
|
|
|
114
98
|
# require_relative "../lib/lutaml/model/toml_adapter/toml_rb_adapter"
|
|
115
99
|
|
|
116
100
|
Lutaml::Model::Config.configure do |config|
|
|
117
|
-
config.xml_adapter_type = if
|
|
118
|
-
:oga
|
|
119
|
-
elsif ENV["XML_ADAPTER"]
|
|
101
|
+
config.xml_adapter_type = if ENV["XML_ADAPTER"]
|
|
120
102
|
ENV["XML_ADAPTER"].to_sym
|
|
121
103
|
else
|
|
122
104
|
:nokogiri
|
|
@@ -124,11 +106,10 @@ Lutaml::Model::Config.configure do |config|
|
|
|
124
106
|
config.hash_adapter_type = :standard
|
|
125
107
|
config.json_adapter_type = :standard
|
|
126
108
|
config.yaml_adapter_type = :standard
|
|
127
|
-
|
|
128
|
-
config.toml_adapter_type = :toml_rb unless RUBY_ENGINE == "opal"
|
|
109
|
+
config.toml_adapter_type = :toml_rb
|
|
129
110
|
end
|
|
130
111
|
|
|
131
|
-
# Configure Canon for XML equivalence testing
|
|
112
|
+
# Configure Canon for XML equivalence testing
|
|
132
113
|
if defined?(Canon::Config)
|
|
133
114
|
Canon::Config.configure do |config|
|
|
134
115
|
config.xml.match.profile = :spec_friendly
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
#
|
|
5
5
|
# Implements Adapter First Strategy:
|
|
6
6
|
# - Start with primary adapter (Nokogiri)
|
|
7
|
-
# - Enable other adapters (Ox
|
|
7
|
+
# - Enable other adapters (Ox) incrementally once they pass full test suite
|
|
8
8
|
#
|
|
9
9
|
# Usage:
|
|
10
10
|
# # Enable only Nokogiri (primary)
|
|
@@ -42,7 +42,7 @@ class TestAdapterConfig
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
# Enable an adapter for testing
|
|
45
|
-
# @param name [Symbol] Adapter name (:nokogiri, :ox
|
|
45
|
+
# @param name [Symbol] Adapter name (:nokogiri, :ox)
|
|
46
46
|
def enable_adapter(name)
|
|
47
47
|
adapters_to_test << name unless adapters_to_test.include?(name)
|
|
48
48
|
end
|
|
@@ -56,7 +56,7 @@ class TestAdapterConfig
|
|
|
56
56
|
|
|
57
57
|
# Get the adapter lane for an engine: the one moxml adapter
|
|
58
58
|
# pinned to that engine.
|
|
59
|
-
# @param name [Symbol] Engine name (:nokogiri, :ox, :
|
|
59
|
+
# @param name [Symbol] Engine name (:nokogiri, :ox, :rexml, :leptris)
|
|
60
60
|
# @return [Class] The pinned adapter class
|
|
61
61
|
def adapter_class(name)
|
|
62
62
|
Lutaml::Xml::Adapter::MoxmlAdapter.for_engine(name)
|
|
@@ -65,7 +65,7 @@ class TestAdapterConfig
|
|
|
65
65
|
# Get list of all available adapter names
|
|
66
66
|
# @return [Array<Symbol>] List of all adapter names
|
|
67
67
|
def all_adapters
|
|
68
|
-
%i[nokogiri ox
|
|
68
|
+
%i[nokogiri ox rexml]
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
# Get engine name by adapter class
|
|
@@ -79,7 +79,7 @@ class TestAdapterConfig
|
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
# Initial configuration: Primary adapter (Nokogiri) only
|
|
82
|
-
# Enable other adapters (Ox
|
|
82
|
+
# Enable other adapters (Ox) incrementally once they pass full test suite
|
|
83
83
|
TestAdapterConfig.configure do |config|
|
|
84
|
-
config.enabled_adapters = %i[nokogiri
|
|
84
|
+
config.enabled_adapters = %i[nokogiri]
|
|
85
85
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.202
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -176,18 +176,13 @@ files:
|
|
|
176
176
|
- ".github/workflows/dependent-tests.yml"
|
|
177
177
|
- ".github/workflows/docs.yml"
|
|
178
178
|
- ".github/workflows/downstream-performance.yml"
|
|
179
|
-
- ".github/workflows/js-pr-check.yml"
|
|
180
|
-
- ".github/workflows/js-sync.yml"
|
|
181
|
-
- ".github/workflows/opal.yml"
|
|
182
179
|
- ".github/workflows/performance.yml"
|
|
183
180
|
- ".github/workflows/rake.yml"
|
|
184
181
|
- ".github/workflows/release.yml"
|
|
185
182
|
- ".gitignore"
|
|
186
|
-
- ".gitmodules"
|
|
187
183
|
- ".irbrc"
|
|
188
184
|
- ".pryrc"
|
|
189
185
|
- ".rspec"
|
|
190
|
-
- ".rspec-opal"
|
|
191
186
|
- ".rubocop.yml"
|
|
192
187
|
- ".rubocop_todo.yml"
|
|
193
188
|
- CODE_OF_CONDUCT.md
|
|
@@ -239,7 +234,6 @@ files:
|
|
|
239
234
|
- docs/_guides/missing-values-handling.adoc
|
|
240
235
|
- docs/_guides/native-engines.adoc
|
|
241
236
|
- docs/_guides/ooxml-examples.adoc
|
|
242
|
-
- docs/_guides/opal.adoc
|
|
243
237
|
- docs/_guides/rdf-serialization.adoc
|
|
244
238
|
- docs/_guides/schema-generation.adoc
|
|
245
239
|
- docs/_guides/schema-import.adoc
|
|
@@ -339,22 +333,6 @@ files:
|
|
|
339
333
|
- exe/lutaml-model
|
|
340
334
|
- flake.lock
|
|
341
335
|
- flake.nix
|
|
342
|
-
- lib/compat/opal/generate_boot.rb
|
|
343
|
-
- lib/compat/opal/js_bundle_entry.rb
|
|
344
|
-
- lib/compat/opal/lutaml_model_boot.rb
|
|
345
|
-
- lib/compat/opal/monitor.rb
|
|
346
|
-
- lib/compat/opal/moxml/adapter/customized_rexml.rb
|
|
347
|
-
- lib/compat/opal/moxml/adapter/customized_rexml/entity_reference.rb
|
|
348
|
-
- lib/compat/opal/moxml/adapter/customized_rexml/formatter.rb
|
|
349
|
-
- lib/compat/opal/moxml_boot.rb
|
|
350
|
-
- lib/compat/opal/objectspace_shim.rb
|
|
351
|
-
- lib/compat/opal/rexml/namespace.rb
|
|
352
|
-
- lib/compat/opal/rexml/parsers/baseparser.rb
|
|
353
|
-
- lib/compat/opal/rexml/source.rb
|
|
354
|
-
- lib/compat/opal/rexml/text.rb
|
|
355
|
-
- lib/compat/opal/rexml/xmltokens.rb
|
|
356
|
-
- lib/compat/opal/rexml_compat.rb
|
|
357
|
-
- lib/compat/opal/yaml_compat.rb
|
|
358
336
|
- lib/lutaml/hash_format.rb
|
|
359
337
|
- lib/lutaml/hash_format/adapter.rb
|
|
360
338
|
- lib/lutaml/hash_format/adapter/document.rb
|
|
@@ -545,7 +523,6 @@ files:
|
|
|
545
523
|
- lib/lutaml/model/attribute_validator.rb
|
|
546
524
|
- lib/lutaml/model/cached_type_resolver.rb
|
|
547
525
|
- lib/lutaml/model/cached_type_resolver/concurrent_map_cache.rb
|
|
548
|
-
- lib/lutaml/model/cached_type_resolver/mutex_hash_cache.rb
|
|
549
526
|
- lib/lutaml/model/choice.rb
|
|
550
527
|
- lib/lutaml/model/cli.rb
|
|
551
528
|
- lib/lutaml/model/collection.rb
|
|
@@ -735,7 +712,6 @@ files:
|
|
|
735
712
|
- lib/lutaml/model/schema/rng_compiler/rng_helpers.rb
|
|
736
713
|
- lib/lutaml/model/schema/rng_compiler/value_type_resolver.rb
|
|
737
714
|
- lib/lutaml/model/schema/schema_builder/nokogiri.rb
|
|
738
|
-
- lib/lutaml/model/schema/schema_builder/oga.rb
|
|
739
715
|
- lib/lutaml/model/schema/shared_methods.rb
|
|
740
716
|
- lib/lutaml/model/schema/templates.rb
|
|
741
717
|
- lib/lutaml/model/schema/templates/model.erb
|
|
@@ -981,7 +957,6 @@ files:
|
|
|
981
957
|
- lib/lutaml/xml/schema/builder.rb
|
|
982
958
|
- lib/lutaml/xml/schema/builder/moxml.rb
|
|
983
959
|
- lib/lutaml/xml/schema/builder/nokogiri.rb
|
|
984
|
-
- lib/lutaml/xml/schema/builder/oga.rb
|
|
985
960
|
- lib/lutaml/xml/schema/builtin_types.rb
|
|
986
961
|
- lib/lutaml/xml/schema/relaxng_schema.rb
|
|
987
962
|
- lib/lutaml/xml/schema/vc_namespace.rb
|
|
@@ -2047,7 +2022,6 @@ files:
|
|
|
2047
2022
|
- spec/lutaml/model/attribute_spec.rb
|
|
2048
2023
|
- spec/lutaml/model/attributes_memo_clear_race_spec.rb
|
|
2049
2024
|
- spec/lutaml/model/binary_attribute_value_spec.rb
|
|
2050
|
-
- spec/lutaml/model/boot_manifest_spec.rb
|
|
2051
2025
|
- spec/lutaml/model/cached_type_resolver_spec.rb
|
|
2052
2026
|
- spec/lutaml/model/cardinality_strict_spec.rb
|
|
2053
2027
|
- spec/lutaml/model/cast_element_form_spec.rb
|
|
@@ -2139,7 +2113,6 @@ files:
|
|
|
2139
2113
|
- spec/lutaml/model/namespace_autoload_spec.rb
|
|
2140
2114
|
- spec/lutaml/model/namespace_versioning_spec.rb
|
|
2141
2115
|
- spec/lutaml/model/one_entry_cache_spec.rb
|
|
2142
|
-
- spec/lutaml/model/opal_smoke_spec.rb
|
|
2143
2116
|
- spec/lutaml/model/optimization_spec.rb
|
|
2144
2117
|
- spec/lutaml/model/ordered_content_spec.rb
|
|
2145
2118
|
- spec/lutaml/model/parse_dispatch_hoist_spec.rb
|
|
@@ -2179,7 +2152,6 @@ files:
|
|
|
2179
2152
|
- spec/lutaml/model/serializable_spec.rb
|
|
2180
2153
|
- spec/lutaml/model/serializable_validation_spec.rb
|
|
2181
2154
|
- spec/lutaml/model/serialization_profiles_spec.rb
|
|
2182
|
-
- spec/lutaml/model/serialize/attribute_definition_block_form_spec.rb
|
|
2183
2155
|
- spec/lutaml/model/serialize/builder_spec.rb
|
|
2184
2156
|
- spec/lutaml/model/serialize_perf_guard_spec.rb
|
|
2185
2157
|
- spec/lutaml/model/services/transformer_spec.rb
|
|
@@ -2285,7 +2257,6 @@ files:
|
|
|
2285
2257
|
- spec/lutaml/xml/adapter/empty_document_diagnostics_spec.rb
|
|
2286
2258
|
- spec/lutaml/xml/adapter/moxml_lane_spec.rb
|
|
2287
2259
|
- spec/lutaml/xml/adapter/nokogiri_adapter_spec.rb
|
|
2288
|
-
- spec/lutaml/xml/adapter/oga_adapter_spec.rb
|
|
2289
2260
|
- spec/lutaml/xml/adapter/order_spec.rb
|
|
2290
2261
|
- spec/lutaml/xml/adapter/over_cap_parse_spec.rb
|
|
2291
2262
|
- spec/lutaml/xml/adapter/ox_adapter_spec.rb
|
|
@@ -2371,7 +2342,6 @@ files:
|
|
|
2371
2342
|
- spec/lutaml/xml/namespace_three_phase_spec.rb
|
|
2372
2343
|
- spec/lutaml/xml/nil_optional_element_namespace_spec.rb
|
|
2373
2344
|
- spec/lutaml/xml/ooxml_namespace_spec.rb
|
|
2374
|
-
- spec/lutaml/xml/opal_xml_spec.rb
|
|
2375
2345
|
- spec/lutaml/xml/ordered_method_spec.rb
|
|
2376
2346
|
- spec/lutaml/xml/out_of_namespace_parsing_spec.rb
|
|
2377
2347
|
- spec/lutaml/xml/parse_dom_retention_spec.rb
|
|
@@ -2467,7 +2437,6 @@ files:
|
|
|
2467
2437
|
- spec/person_spec.rb
|
|
2468
2438
|
- spec/sample_model_spec.rb
|
|
2469
2439
|
- spec/spec_helper.rb
|
|
2470
|
-
- spec/support/opal.rb
|
|
2471
2440
|
- spec/support/test_adapter_config.rb
|
|
2472
2441
|
- spec/support/test_namespaces.rb
|
|
2473
2442
|
- spec/support/trace_helper.rb
|