lutaml-model 0.8.116 → 0.8.117

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd6d747592ab333f3edefaf4af21e7db87189a39c541bd7c70dda87b544615d8
4
- data.tar.gz: 2380f18d9b82122602c3afc60695dd2077c2cc125375032673f90721d152fa53
3
+ metadata.gz: 49af9f0bc6f8dd954e93d9d3ac641e212dbf526486c9c8a2eb3460ccfbf01cbf
4
+ data.tar.gz: cf20d264b0827b500c0dde7340b721c5ea89235341a55ef603f3e41dd461a31a
5
5
  SHA512:
6
- metadata.gz: d15bea65d1270d4eda9e07bbac48cee6232da11aab2df7bcbd51e74ab1ec8d9ecf2eb217b1b9d302cfdf128a2b51b610bd1062e7bfea1a81a65f68d16f952c43
7
- data.tar.gz: 976d507e33e4a79de59b767215279bee14aaba443a05bfb8c84918190e236faa19d4383af9a0b3b20c3743dbd95e47404967b37a0611619738bd9fe4667af6bb
6
+ metadata.gz: 62359095df53c8835748e08c60c8648f6e07a4e892536da699ded2f255ec176a8aee3e648012d27e62909af5e34426118f465d93adf616ed005e22273e990fbc
7
+ data.tar.gz: 7e1d1f54a24252a44a31e2a0d45e878c13b9a5d44115a856aafd383cf24adb731ad585d52b8a8d9d648557ee150e2c0b776a1edd18b405bf16c79e76fbf4c2a8
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.8.116"
5
+ VERSION = "0.8.117"
6
6
  end
7
7
  end
@@ -485,8 +485,12 @@ module Lutaml
485
485
  # namespace). Contested names dispatch strictly by
486
486
  # (URI, local), falling back to URI-less rows.
487
487
  name = object.name
488
+ # Order entries may carry names with no mapped row (the
489
+ # parse records every child in document order); the
490
+ # layout cache kills its default proc to stay
491
+ # mutation-free, so a miss reads nil and drops below.
488
492
  keys = name_keys[name]
489
- if keys.length == 1
493
+ if keys&.length == 1
490
494
  dispatch_key = keys.first
491
495
  entry = rows_by_name[dispatch_key]
492
496
  else
@@ -516,6 +516,28 @@ RSpec.describe "XML plan fast path" do
516
516
  expect(fast_out).to include(%(<para kind="a">Hi <emph>there</emph> bye <emph>again</emph>!</para>))
517
517
  end
518
518
 
519
+ it "drops order entries whose names have no mapped row" do
520
+ klass = Class.new(Lutaml::Model::Serializable) do
521
+ attribute :a, :string, collection: true
522
+
523
+ xml do
524
+ element "d"
525
+ ordered
526
+ map_element "a", to: :a
527
+ end
528
+ end
529
+ xml = %(<d><a>1</a><note>extra</note><a>2</a></d>)
530
+
531
+ Lutaml::Model::Config.instance.xml_plan_fast_path = false
532
+ interp = klass.from_xml(xml).to_xml
533
+ Lutaml::Model::Config.instance.xml_plan_fast_path = true
534
+ fast_out = klass.from_xml(xml).to_xml
535
+ Lutaml::Model::Config.instance.xml_plan_fast_path = false
536
+
537
+ expect(fast_out).to eq(interp)
538
+ expect(fast_out).to eq("<d>\n <a>1</a>\n <a>2</a>\n</d>")
539
+ end
540
+
519
541
  it "reflects content mutations through the ordered fast serializer" do
520
542
  para = Class.new(Lutaml::Model::Serializable) do
521
543
  attribute :emph, :string, collection: true
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.116
4
+ version: 0.8.117
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.