xsd 2.6.1 → 2.6.3
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 +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +9 -0
- data/lib/xsd/base_object.rb +28 -15
- data/lib/xsd/objects/attribute.rb +3 -4
- data/lib/xsd/objects/element.rb +1 -1
- data/lib/xsd/shared/named.rb +1 -2
- data/lib/xsd/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1d2b1ea3cf4fb7f11e131e1a7cb9f446682b8be0bb1a38bb90817a9c0ef8717
|
4
|
+
data.tar.gz: edbb623f773bd0909284728b42e71e8a49d6663159e7382d12cb9229f4057b05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b474c9ac63f1dd09b4b1aef416eee487aeaa84135f12242ba7a9fde520094a42279a738b5ef99e4540b622c35b4dc0b581d1ec3b44fd6a98217022dba1ab66a
|
7
|
+
data.tar.gz: ea99e743a50f84952b78f2d43463482ab630175c7eafcc92567bb9a35044698a50b2b2d6e92d33f274b07a3b8f6b3d639358d6d4020b8db140350396c3e3e9c2
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## [2.6.3] - 2024-04-13
|
2
|
+
|
3
|
+
- Fix retrieving documentation for referenced elements
|
4
|
+
- Cache "namespace" call result
|
5
|
+
|
6
|
+
## [2.6.2] - 2024-04-12
|
7
|
+
|
8
|
+
- Get default value for element/attribute "form" property from schema
|
9
|
+
|
1
10
|
## [2.6.1] - 2024-04-12
|
2
11
|
|
3
12
|
- Correctly detect namespace for referenced elements
|
data/lib/xsd/base_object.rb
CHANGED
@@ -189,7 +189,16 @@ module XSD
|
|
189
189
|
# Return element documentation
|
190
190
|
# @return Array<String>
|
191
191
|
def documentation
|
192
|
-
|
192
|
+
@documentation ||= begin
|
193
|
+
docs = documentation_for(node)
|
194
|
+
if docs.any?
|
195
|
+
docs
|
196
|
+
elsif is_a?(Referenced) && referenced?
|
197
|
+
documentation_for(reference.node)
|
198
|
+
else
|
199
|
+
[]
|
200
|
+
end
|
201
|
+
end
|
193
202
|
end
|
194
203
|
|
195
204
|
# Return documentation for specified node
|
@@ -304,20 +313,24 @@ module XSD
|
|
304
313
|
# check for property first
|
305
314
|
if (property = self.class.properties[method])
|
306
315
|
value = property[:resolve] ? property[:resolve].call(self) : node[property[:name].to_s]
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
316
|
+
r = if value.nil?
|
317
|
+
if node['ref']
|
318
|
+
# if object has reference - search property in referenced object
|
319
|
+
reference.send(method, *args)
|
320
|
+
else
|
321
|
+
property[:default].is_a?(Proc) ? instance_eval(&property[:default]) : property[:default]
|
322
|
+
end
|
323
|
+
else
|
324
|
+
case property[:type]
|
325
|
+
when :integer
|
326
|
+
property[:name] == :maxOccurs && value == 'unbounded' ? :unbounded : value.to_i
|
327
|
+
when :boolean
|
328
|
+
value == 'true'
|
329
|
+
else
|
330
|
+
value
|
331
|
+
end
|
332
|
+
end
|
333
|
+
return @cache[method] = r
|
321
334
|
end
|
322
335
|
|
323
336
|
# if object has ref it cannot contain any type and children, so proxy call to target object
|
@@ -28,15 +28,14 @@ module XSD
|
|
28
28
|
property :fixed, :string
|
29
29
|
|
30
30
|
# Optional. Specifies the form for the attribute. The default value is the value of the attributeFormDefault
|
31
|
-
# attribute of the
|
31
|
+
# attribute of the schema containing the attribute. Can be set to one of the following:
|
32
32
|
# qualified - indicates that this attribute must be qualified with the namespace prefix and the no-colon-name
|
33
33
|
# (NCName) of the attribute
|
34
34
|
# unqualified - indicates that this attribute is not required to be qualified with the namespace prefix and is
|
35
35
|
# matched against the (NCName) of the attribute
|
36
36
|
# @!attribute form
|
37
|
-
# @return String
|
38
|
-
|
39
|
-
property :form, :string
|
37
|
+
# @return String
|
38
|
+
property :form, :string, default: proc { schema.attribute_form_default }
|
40
39
|
|
41
40
|
# Optional. Specifies a built-in data type or a simple type. The type attribute can only be present when the
|
42
41
|
# content does not contain a simpleType element
|
data/lib/xsd/objects/element.rb
CHANGED
@@ -47,7 +47,7 @@ module XSD
|
|
47
47
|
# cannot be used if the parent element is the schema element
|
48
48
|
# @!attribute form
|
49
49
|
# @return String
|
50
|
-
property :form, :string
|
50
|
+
property :form, :string, default: proc { schema.element_form_default }
|
51
51
|
|
52
52
|
# Optional. Specifies whether an explicit null value can be assigned to the element. True enables an instance of
|
53
53
|
# the element to have the null attribute set to true. The null attribute is defined as part of the XML Schema
|
data/lib/xsd/shared/named.rb
CHANGED
@@ -5,8 +5,7 @@ module XSD
|
|
5
5
|
# Get definition namespace
|
6
6
|
# @return String
|
7
7
|
def namespace
|
8
|
-
|
9
|
-
is_referenced && referenced? ? reference.schema.target_namespace : schema.target_namespace
|
8
|
+
@namespace ||= (is_a?(Referenced) && referenced? ? reference.schema : schema).target_namespace
|
10
9
|
end
|
11
10
|
|
12
11
|
# Get absolute definition name
|
data/lib/xsd/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- d.arkhipov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|