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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c99faff9d9708ef506066511872124dc5a3b0c8fb81b8754e9994597855d4ad1
|
|
4
|
+
data.tar.gz: 89639853feb6000854c88e471077aa4287afe099a7101f7fe52325c764f59e72
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 49377837acaeb059625140e4d02712c5b6cf4fe64abb94999c835b4ee80265debf60e669f5417816f1b1d82477e4483dc8971436358a0f3e427151b218c18240
|
|
7
|
+
data.tar.gz: 2c650806f8322434d3cae7943bd406e52c02ed3f23e48dc1244e614cc4dd70bb058050e25d01847957e0d6d5a0a92422c8d8ea9f58d03b361d9d004bf204cdab
|
data/lib/lutaml/model/version.rb
CHANGED
|
@@ -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
|