lutaml-model 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dependent-tests.yml +2 -0
  3. data/.rubocop_todo.yml +39 -13
  4. data/Gemfile +1 -0
  5. data/README.adoc +396 -23
  6. data/lib/lutaml/model/constants.rb +7 -0
  7. data/lib/lutaml/model/error/type/invalid_value_error.rb +19 -0
  8. data/lib/lutaml/model/error.rb +1 -0
  9. data/lib/lutaml/model/key_value_mapping.rb +31 -2
  10. data/lib/lutaml/model/mapping_hash.rb +8 -0
  11. data/lib/lutaml/model/mapping_rule.rb +4 -0
  12. data/lib/lutaml/model/schema/templates/simple_type.rb +247 -0
  13. data/lib/lutaml/model/schema/xml_compiler.rb +720 -0
  14. data/lib/lutaml/model/schema.rb +5 -0
  15. data/lib/lutaml/model/serialize.rb +24 -8
  16. data/lib/lutaml/model/toml_adapter/toml_rb_adapter.rb +1 -2
  17. data/lib/lutaml/model/type/hash.rb +11 -11
  18. data/lib/lutaml/model/version.rb +1 -1
  19. data/lib/lutaml/model/xml_adapter/nokogiri_adapter.rb +5 -1
  20. data/lib/lutaml/model/xml_adapter/xml_document.rb +11 -15
  21. data/lib/lutaml/model/xml_mapping.rb +4 -2
  22. data/lib/lutaml/model/xml_mapping_rule.rb +1 -4
  23. data/lib/lutaml/model.rb +1 -0
  24. data/spec/fixtures/xml/invalid_math_document.xml +4 -0
  25. data/spec/fixtures/xml/math_document_schema.xsd +56 -0
  26. data/spec/fixtures/xml/test_schema.xsd +53 -0
  27. data/spec/fixtures/xml/valid_math_document.xml +4 -0
  28. data/spec/lutaml/model/cdata_spec.rb +2 -2
  29. data/spec/lutaml/model/custom_model_spec.rb +7 -20
  30. data/spec/lutaml/model/key_value_mapping_spec.rb +27 -0
  31. data/spec/lutaml/model/map_all_spec.rb +188 -0
  32. data/spec/lutaml/model/mixed_content_spec.rb +15 -15
  33. data/spec/lutaml/model/schema/xml_compiler_spec.rb +1431 -0
  34. data/spec/lutaml/model/with_child_mapping_spec.rb +2 -2
  35. data/spec/lutaml/model/xml_adapter/xml_namespace_spec.rb +52 -0
  36. data/spec/lutaml/model/xml_mapping_spec.rb +108 -1
  37. metadata +12 -2
@@ -539,10 +539,10 @@ RSpec.describe "MixedContent" do
539
539
  let(:expected_nokogiri_xml) do
540
540
  <<~XML
541
541
  <SpecialCharContentWithRawOptionAndMixedOption><special>
542
- B &lt;p&gt;R&amp;amp;C&lt;/p&gt;
543
- C &lt;p&gt;J&amp;#x2014;C&lt;/p&gt;
544
- O &lt;p&gt;A &amp;amp; B &lt;/p&gt;
545
- F &lt;p&gt;Z &amp;#xA9;S&lt;/p&gt;
542
+ B <p>R&amp;C</p>
543
+ C <p>JC</p>
544
+ O <p>A &amp; B </p>
545
+ F <p>Z ©S</p>
546
546
  </special></SpecialCharContentWithRawOptionAndMixedOption>
547
547
  XML
548
548
  end
@@ -550,10 +550,10 @@ RSpec.describe "MixedContent" do
550
550
  let(:expected_ox_xml) do
551
551
  <<~XML
552
552
  <SpecialCharContentWithRawOptionAndMixedOption>
553
- <special> B &lt;p&gt;R&amp;amp;C&lt;/p&gt;
554
- C &lt;p&gt;J—C&lt;/p&gt;
555
- O &lt;p&gt;A &amp;amp; B &lt;/p&gt;
556
- F &lt;p&gt;Z ©S&lt;/p&gt;
553
+ <special> B <p>R&amp;C</p>
554
+ C <p>J—C</p>
555
+ O <p>A &amp; B </p>
556
+ F <p>Z ©S</p>
557
557
  </special>
558
558
  </SpecialCharContentWithRawOptionAndMixedOption>
559
559
  XML
@@ -562,10 +562,10 @@ RSpec.describe "MixedContent" do
562
562
  let(:expected_oga_xml) do
563
563
  <<~XML
564
564
  <SpecialCharContentWithRawOptionAndMixedOption>
565
- <special> B &lt;p&gt;R&amp;C&lt;/p&gt;
566
- C &lt;p&gt;J—C&lt;/p&gt;
567
- O &lt;p&gt;A &amp; B &lt;/p&gt;
568
- F &lt;p&gt;Z ©S&lt;/p&gt;
565
+ <special> B <p>R&amp;C</p>
566
+ C <p>J—C</p>
567
+ O <p>A &amp; B </p>
568
+ F <p>Z ©S</p>
569
569
  </special>
570
570
  </SpecialCharContentWithRawOptionAndMixedOption>
571
571
  XML
@@ -604,9 +604,9 @@ RSpec.describe "MixedContent" do
604
604
  end
605
605
 
606
606
  describe ".to_xml" do
607
- let(:expected_nokogiri_xml) { "B &lt;p&gt;R&lt;/p&gt;" }
608
- let(:expected_oga_xml) { "B &lt;p&gt;R&amp;C&lt;/p&gt;" }
609
- let(:expected_ox_xml) { "B &lt;p&gt;R&amp;amp;C&lt;/p&gt;" }
607
+ let(:expected_nokogiri_xml) { "B <p>R</p>" }
608
+ let(:expected_oga_xml) { "B <p>R&amp;C</p>" }
609
+ let(:expected_ox_xml) { "B <p>R&amp;C</p>" }
610
610
 
611
611
  it "serializes special char mixed content correctly" do
612
612
  parsed = MixedContentSpec::SpecialCharContentWithRawAndMixedOption.from_xml(xml)