lutaml-model 0.8.56 → 0.8.57

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: 8eaff3e9ef7cbf71d8cd5adbf05161b81c43399c92a1c741023005722c190025
4
- data.tar.gz: bd4383a644f8878226034c191215780c38b5f1beee2cdf196e26d31067908878
3
+ metadata.gz: 6c9021265ddf0425193ec4ce5656b3209e73291534bac83f7863494ca5dd2f55
4
+ data.tar.gz: d389a3ad85a1d8b72d953df5cf3ff6b0728625aeabc9ebd6563163ee44374071
5
5
  SHA512:
6
- metadata.gz: 00453571fbb8c6b2540f3d545fe53d0c664fa18301797e5192699a6dded982ca9280a4ac39dcc2a7c60f03746ee0dc986e9571c05f9f387f503ba6ab2b522d5c
7
- data.tar.gz: bdf133791492a00bb00babcc2b1037366918e6eba7bb05001d4b5748152249c7e45c47c0dbd099c72e0f99acf949febf8ae36f43bb99b43b35874112da3f6312
6
+ metadata.gz: 8580ac7ac155d6d72a008b7f29c1f6e8001b45f1e19235c863d53b8f23bf84cf7953b5bbdd2e1b57f9056e583cb49fad114f9487b82eb331172a88a3b071fcd2
7
+ data.tar.gz: c74e408cc7a50c3b7badc51cd3ca3711a54c41dfe0fdedf2f37f3a3232a6ec615a92539befc891b9d3235c0ed873aadc674f58fcc8d542032da03d436baba9a6
@@ -103,7 +103,8 @@ module Lutaml
103
103
 
104
104
  register = Lutaml::Model::Config.default_register
105
105
  plan = Lutaml::Xml::PlanCompiler.compile(self, register)
106
- return nil unless plan && Lutaml::Xml::PlanSerializer.serializable?(plan)
106
+ return nil unless plan && !plan[:namespaced] &&
107
+ Lutaml::Xml::PlanSerializer.serializable?(plan)
107
108
 
108
109
  Lutaml::Xml::PlanSerializer.call(instance, plan)
109
110
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.8.56"
5
+ VERSION = "0.8.57"
6
6
  end
7
7
  end
@@ -213,6 +213,12 @@ module Lutaml
213
213
 
214
214
  row_tags = partition_row_tags!(compiled, rows, tag)
215
215
 
216
+ # The plan serializer does not emit namespace declarations —
217
+ # namespaced models serialize through the interpretive
218
+ # writer (lutaml-model#847: standalone to_xml under leptris
219
+ # dropped the element xmlns entirely).
220
+ namespaced = !model_ns.nil? || rows.any? { |r| r[:ns] }
221
+
216
222
  flags = []
217
223
  flags << :cdata if cdata
218
224
  flags << :mixed_content if mixed_content
@@ -233,7 +239,7 @@ module Lutaml
233
239
 
234
240
  { descriptor: descriptor, tree: tree, rows: compiled,
235
241
  attr_rows: attr_rows, mapping: mapping,
236
- row_tags: row_tags,
242
+ row_tags: row_tags, namespaced: namespaced,
237
243
  ordered: mapping.ordered? || mapping.mixed_content?,
238
244
  needs_nodes: needs_nodes,
239
245
  collection_defaults: collection_defaults }
@@ -688,4 +688,29 @@ RSpec.describe "XML plan fast path" do
688
688
  expect(parsed.to_xml).to eq(xml)
689
689
  end
690
690
  end
691
+
692
+ # lutaml-model#847: the plan serializer does not emit namespace
693
+ # declarations — namespaced models must serialize through the
694
+ # interpretive writer even standalone, or the element xmlns is lost.
695
+ it "falls back to the interpretive writer for namespaced models" do
696
+ ns = Class.new(Lutaml::Xml::Namespace) do
697
+ uri "http://example.com/ord847"
698
+ end
699
+ stub_const("PlanFastPath::Ord847Ns", ns)
700
+ klass = Class.new(Lutaml::Model::Serializable) do
701
+ attribute :value, :boolean
702
+ xml do
703
+ element "updateFields"
704
+ namespace PlanFastPath::Ord847Ns
705
+ map_attribute "val", to: :value
706
+ end
707
+ end
708
+ stub_const("PlanFastPath::UpdateFields847", klass)
709
+
710
+ expect(klass.new(value: false).to_xml).to include("http://example.com/ord847")
711
+ plan = Lutaml::Xml::PlanCompiler.compile(
712
+ klass, Lutaml::Model::Config.default_register
713
+ )
714
+ expect(plan[:namespaced]).to be(true)
715
+ end
691
716
  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.56
4
+ version: 0.8.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.