xsd 2.9.3 → 2.9.4
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/CHANGELOG.md +8 -0
- data/Gemfile.lock +89 -0
- data/Rakefile +48 -0
- data/lib/xsd/version.rb +1 -1
- data/sig/xsd.rbs +1071 -0
- data/sig/xsd_members.rbs +231 -0
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c17599aba21b245c4fd47315a81a25ff3241d5d8a5426f9d9b5a0d799c006d73
|
|
4
|
+
data.tar.gz: 22b50cc67c455af6e591e590b6692603f1346c0139c700084b53902c7dacb16f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2d287545ee5c890c0d355f88c45ee839090d0ea03e9c747b43d6d6b52d1904e76b119d6737f77d971e6c45633664e71e875ce4993c3f760d761d8b833cac4311
|
|
7
|
+
data.tar.gz: f7a3db6bc00a00e44f88f1f9ecba06a0dc73bcabcb869ba37cb33980b067921239741384afc131fa210fbc84b23a4af57f725c82350d82861fcd2fc4528f9478
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [2.9.4] - 2026-10-26
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- RBS signatures in `sig/`: `xsd.rbs` from `rbs prototype rb` of `lib/`, and `xsd_members.rbs` with the readers that
|
|
6
|
+
`BaseObject.property`, `.child` and `.link` define for each class (`Element#name`, `#complex_type`, `#max_occurs`
|
|
7
|
+
as `Integer | :unbounded`, …), generated by `rake rbs:members` — run it after changing a class's members.
|
|
8
|
+
|
|
1
9
|
## [2.9.3] - 2026-10-24
|
|
2
10
|
|
|
3
11
|
### Fixed
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
xsd (2.9.4)
|
|
5
|
+
builder (~> 3.2)
|
|
6
|
+
nokogiri (~> 1.11)
|
|
7
|
+
rake (~> 13.0)
|
|
8
|
+
|
|
9
|
+
GEM
|
|
10
|
+
remote: https://rubygems.org/
|
|
11
|
+
specs:
|
|
12
|
+
ast (2.4.3)
|
|
13
|
+
builder (3.2.4)
|
|
14
|
+
diff-lcs (1.5.0)
|
|
15
|
+
json (3.1.0)
|
|
16
|
+
language_server-protocol (3.17.0.6)
|
|
17
|
+
lint_roller (1.1.0)
|
|
18
|
+
logger (1.5.3)
|
|
19
|
+
mini_portile2 (2.8.9)
|
|
20
|
+
nokogiri (1.16.3)
|
|
21
|
+
mini_portile2 (~> 2.8.2)
|
|
22
|
+
racc (~> 1.4)
|
|
23
|
+
parallel (2.3.0)
|
|
24
|
+
parser (3.3.13.0)
|
|
25
|
+
ast (~> 2.4.1)
|
|
26
|
+
racc
|
|
27
|
+
prism (1.9.0)
|
|
28
|
+
racc (1.8.1)
|
|
29
|
+
rainbow (3.1.1)
|
|
30
|
+
rake (13.0.6)
|
|
31
|
+
regexp_parser (2.13.1)
|
|
32
|
+
rspec (3.12.0)
|
|
33
|
+
rspec-core (~> 3.12.0)
|
|
34
|
+
rspec-expectations (~> 3.12.0)
|
|
35
|
+
rspec-mocks (~> 3.12.0)
|
|
36
|
+
rspec-core (3.12.2)
|
|
37
|
+
rspec-support (~> 3.12.0)
|
|
38
|
+
rspec-expectations (3.12.3)
|
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
40
|
+
rspec-support (~> 3.12.0)
|
|
41
|
+
rspec-mocks (3.12.6)
|
|
42
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
43
|
+
rspec-support (~> 3.12.0)
|
|
44
|
+
rspec-support (3.12.1)
|
|
45
|
+
rubocop (1.92.1)
|
|
46
|
+
json (>= 2.3)
|
|
47
|
+
language_server-protocol (~> 3.17.0.2)
|
|
48
|
+
lint_roller (~> 1.1.0)
|
|
49
|
+
parallel (>= 1.10)
|
|
50
|
+
parser (>= 3.3.0.2)
|
|
51
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
52
|
+
regexp_parser (>= 2.11.3, < 3.0)
|
|
53
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
54
|
+
ruby-progressbar (~> 1.7)
|
|
55
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
56
|
+
rubocop-ast (1.50.0)
|
|
57
|
+
parser (>= 3.3.7.2)
|
|
58
|
+
prism (~> 1.7)
|
|
59
|
+
rubocop-performance (1.27.0)
|
|
60
|
+
lint_roller (~> 1.1)
|
|
61
|
+
rubocop (>= 1.89.0, < 2.0)
|
|
62
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
63
|
+
rubocop-rake (0.7.1)
|
|
64
|
+
lint_roller (~> 1.1)
|
|
65
|
+
rubocop (>= 1.72.1)
|
|
66
|
+
rubocop-rspec (3.10.2)
|
|
67
|
+
lint_roller (~> 1.1)
|
|
68
|
+
regexp_parser (>= 2.0)
|
|
69
|
+
rubocop (~> 1.86, >= 1.86.2)
|
|
70
|
+
ruby-progressbar (1.13.0)
|
|
71
|
+
unicode-display_width (3.3.0)
|
|
72
|
+
unicode-emoji (~> 4.3)
|
|
73
|
+
unicode-emoji (4.3.0)
|
|
74
|
+
|
|
75
|
+
PLATFORMS
|
|
76
|
+
x86_64-darwin-22
|
|
77
|
+
x86_64-darwin-23
|
|
78
|
+
|
|
79
|
+
DEPENDENCIES
|
|
80
|
+
logger (~> 1.5)
|
|
81
|
+
rspec (~> 3.12)
|
|
82
|
+
rubocop (~> 1.92)
|
|
83
|
+
rubocop-performance (~> 1.27)
|
|
84
|
+
rubocop-rake (~> 0.7)
|
|
85
|
+
rubocop-rspec (~> 3.8)
|
|
86
|
+
xsd!
|
|
87
|
+
|
|
88
|
+
BUNDLED WITH
|
|
89
|
+
2.4.11
|
data/Rakefile
CHANGED
|
@@ -15,6 +15,54 @@ RuboCop::RakeTask.new do |t|
|
|
|
15
15
|
t.options = ['--display-cop-names']
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
namespace :rbs do
|
|
19
|
+
desc 'Generate sig/xsd_members.rbs: the readers BaseObject.property, .child and .link define for each class'
|
|
20
|
+
task :members do
|
|
21
|
+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
|
22
|
+
require 'xsd'
|
|
23
|
+
|
|
24
|
+
scalars = { string: 'String', boolean: 'bool', integer: 'Integer', array: 'Array[untyped]' }
|
|
25
|
+
class_of = ->(type) { XSD::XML::CLASS_MAP[type.to_s]&.name&.delete_prefix('XSD::') || 'BaseObject' }
|
|
26
|
+
lines = []
|
|
27
|
+
XSD.constants.map { |name| XSD.const_get(name) }.select { |k| k.is_a?(Class) && k <= XSD::BaseObject }
|
|
28
|
+
.sort_by(&:name).each do |klass|
|
|
29
|
+
superclass = klass.superclass
|
|
30
|
+
own = lambda do |kind|
|
|
31
|
+
members = klass.public_send(kind)
|
|
32
|
+
superclass.respond_to?(kind) ? members.reject { |name, spec| superclass.public_send(kind)[name] == spec } : members
|
|
33
|
+
end
|
|
34
|
+
# a method the class or an ancestor defines itself wins over the reader, and is declared in xsd.rbs
|
|
35
|
+
explicit = lambda do |name|
|
|
36
|
+
klass.method_defined?(name) && klass.instance_method(name).owner.name && klass.instance_method(name).owner != Object
|
|
37
|
+
end
|
|
38
|
+
readers = {}
|
|
39
|
+
own.call(:properties).each do |name, spec|
|
|
40
|
+
type = scalars.fetch(spec[:type], 'untyped')
|
|
41
|
+
type = "#{type}?" unless spec[:required] || spec.key?(:default) || type.start_with?('Array')
|
|
42
|
+
type = '(Integer | :unbounded)' if name == :max_occurs
|
|
43
|
+
readers[name] ||= type unless explicit.call(name)
|
|
44
|
+
end
|
|
45
|
+
[*own.call(:children), *own.call(:links)].each do |name, spec|
|
|
46
|
+
type = spec[:type]
|
|
47
|
+
readers[name] ||= (type.is_a?(Array) ? "Array[#{class_of.call(type.first)}]" : "#{class_of.call(type)}?") unless explicit.call(name)
|
|
48
|
+
end
|
|
49
|
+
next if readers.empty?
|
|
50
|
+
|
|
51
|
+
lines << " class #{klass.name.delete_prefix('XSD::')}"
|
|
52
|
+
readers.each { |name, type| lines << " def #{name}: () -> #{type}" }
|
|
53
|
+
lines << ' end' << ''
|
|
54
|
+
end
|
|
55
|
+
File.write(File.expand_path('sig/xsd_members.rbs', __dir__), <<~RBS)
|
|
56
|
+
# Generated by `rake rbs:members` — do not edit. The readers BaseObject's `property`, `child` and `link`
|
|
57
|
+
# define for each class: a property is its value (nil when absent and without a default), a child or a link
|
|
58
|
+
# the object or objects it names.
|
|
59
|
+
module XSD
|
|
60
|
+
#{lines.join("\n").rstrip}
|
|
61
|
+
end
|
|
62
|
+
RBS
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
18
66
|
desc 'Run tests'
|
|
19
67
|
task test: :spec
|
|
20
68
|
|
data/lib/xsd/version.rb
CHANGED