lutaml-model 0.8.186 → 0.8.187

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: ea63d75c561923cb1286edc3d320fb2e24aa39ed9318a19cabbcf73659f3b9c1
4
- data.tar.gz: 7dda5b3ee35853aae9dada687a762641bddb5ced2e55dc606c22a8c87b44f451
3
+ metadata.gz: c99faff9d9708ef506066511872124dc5a3b0c8fb81b8754e9994597855d4ad1
4
+ data.tar.gz: 89639853feb6000854c88e471077aa4287afe099a7101f7fe52325c764f59e72
5
5
  SHA512:
6
- metadata.gz: 78e413d5a78c52d788e6bcea704b4365afb081671bf2886f84deac7b9ff9e44b574ef38256632c894aa4bfb675aadf692f2b260540d3901bc3a868e39a843624
7
- data.tar.gz: 95f5e0d1466f68e79287c797b0dba6421d045df2806449e179dba73eb6d395c7eb590c031031cc842917f39f74cf80d89adf0871c4554848c680013a4efaee5d
6
+ metadata.gz: 49377837acaeb059625140e4d02712c5b6cf4fe64abb94999c835b4ee80265debf60e669f5417816f1b1d82477e4483dc8971436358a0f3e427151b218c18240
7
+ data.tar.gz: 2c650806f8322434d3cae7943bd406e52c02ed3f23e48dc1244e614cc4dd70bb058050e25d01847957e0d6d5a0a92422c8d8ea9f58d03b361d9d004bf204cdab
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.8.186"
5
+ VERSION = "0.8.187"
6
6
  end
7
7
  end
@@ -10,6 +10,7 @@ module Lutaml
10
10
  class OpenContent < Base
11
11
  attribute :id, :string
12
12
  attribute :mode, :string
13
+ attribute :any, :any
13
14
  attribute :annotation, :annotation
14
15
 
15
16
  xml do
@@ -19,6 +20,7 @@ module Lutaml
19
20
 
20
21
  map_attribute :id, to: :id
21
22
  map_attribute :mode, to: :mode
23
+ map_element :any, to: :any
22
24
  map_element :annotation, to: :annotation
23
25
  end
24
26
 
@@ -31,6 +31,8 @@ module Lutaml
31
31
  initialize_empty: true
32
32
  attribute :fraction_digits, :fraction_digits, collection: true,
33
33
  initialize_empty: true
34
+ attribute :assertion, :assert, collection: true,
35
+ initialize_empty: true
34
36
 
35
37
  xml do
36
38
  element "restriction"
@@ -53,6 +55,7 @@ module Lutaml
53
55
  map_element :maxInclusive, to: :max_inclusive
54
56
  map_element :minInclusive, to: :min_inclusive
55
57
  map_element :fractionDigits, to: :fraction_digits
58
+ map_element :assertion, to: :assertion
56
59
  end
57
60
 
58
61
  Lutaml::Xml::Schema::Xsd.register_model(self,
@@ -117,4 +117,44 @@ RSpec.describe "XSD 1.1 constructs (#1203)" do
117
117
  expect(emitted).to include("<xs:alternative")
118
118
  expect(emitted).to include('type="T"')
119
119
  end
120
+
121
+ it "maps xs:assertion on a simpleType restriction" do
122
+ xsd = <<~XSD
123
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
124
+ <xs:simpleType name="num">
125
+ <xs:restriction base="xs:string">
126
+ <xs:assertion test="$value castable as xs:double"/>
127
+ </xs:restriction>
128
+ </xs:simpleType>
129
+ </xs:schema>
130
+ XSD
131
+
132
+ schema = Lutaml::Xml::Schema::Xsd.parse(xsd)
133
+ assertion = schema.simple_type.first.restriction.assertion.first
134
+
135
+ expect(assertion).not_to be_nil
136
+ expect(assertion.test).to eq("$value castable as xs:double")
137
+ end
138
+
139
+ it "keeps the xs:any wildcard on xs:openContent" do
140
+ xsd = <<~XSD
141
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
142
+ <xs:complexType name="t">
143
+ <xs:sequence>
144
+ <xs:element name="a"/>
145
+ </xs:sequence>
146
+ <xs:openContent mode="interleave">
147
+ <xs:any namespace="http://open.example/" processContents="lax"/>
148
+ </xs:openContent>
149
+ </xs:complexType>
150
+ </xs:schema>
151
+ XSD
152
+
153
+ schema = Lutaml::Xml::Schema::Xsd.parse(xsd)
154
+ any = schema.complex_type.first.open_content.any
155
+
156
+ expect(any).not_to be_nil
157
+ expect(any.namespace).to eq("http://open.example/")
158
+ expect(any.process_contents).to eq("lax")
159
+ end
120
160
  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.186
4
+ version: 0.8.187
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.