wasabi 5.0.2 → 5.1.0
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 +9 -0
- data/README.md +5 -0
- data/lib/wasabi/document.rb +13 -9
- data/lib/wasabi/parser.rb +38 -22
- data/lib/wasabi/version.rb +1 -1
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af912c6da83bd8794f7929d89c792716f295b9949c6f6acf30211cdf7a608d9f
|
4
|
+
data.tar.gz: 7c4826039acd022be1150ddde566e3217653b594199a42b55de82a36c2225109
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ba504cc015d6b070728279f8a50bc0b4e46c5a375fca2b2a4912c20f3d731c2a37dea913380397e7d2bdc8317c3f38cbb27f4c204ca2b5954087bbb464de1cb
|
7
|
+
data.tar.gz: 207e7d588b64eab57a496b4de40fa5da60b75d140f3452714415d4400155b6d8fc4633907c402726d6c3ae0bc87e88942873f18d4b5cea4960afbb1b8b4f36eb
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,15 @@
|
|
4
4
|
|
5
5
|
- _Your new line here. Mind the style of prefix used in the rest of the document._
|
6
6
|
|
7
|
+
## 5.1.0 (2024-10-27)
|
8
|
+
|
9
|
+
- Segment declared types by namespace to distinguish distinct types by @RickSnyder in https://github.com/savonrb/wasabi/pull/57
|
10
|
+
- Adjust input parsing by @pcai in https://github.com/savonrb/wasabi/pull/122
|
11
|
+
|
12
|
+
## 5.0.3 (2024-07-20)
|
13
|
+
|
14
|
+
- Relax faraday version restriction by @ChristopherBert in https://github.com/savonrb/wasabi/pull/120
|
15
|
+
|
7
16
|
## 5.0.2 (2024-02-27)
|
8
17
|
|
9
18
|
- Fix input/output for style="rpc" operations ([#119](https://github.com/savonrb/wasabi/pull/119)).
|
data/README.md
CHANGED
@@ -63,3 +63,8 @@ document.operations
|
|
63
63
|
# => { :create_user => { :input => "createUser", :action => "createUser" },
|
64
64
|
# => :find_user => { :input => "findUser", :action => "findUser" } }
|
65
65
|
```
|
66
|
+
|
67
|
+
## Upgrading to Wasabi 5.x
|
68
|
+
|
69
|
+
Wasabi 5.x adds support for (and defaults to) [Faraday](https://lostisland.github.io/faraday/#/) for its HTTP transport. For compatibility, it will continue to prefer
|
70
|
+
[HTTPI](https://github.com/savonrb/httpi) if it is present. Newer versions of Savon require Wasabi 5.x as part of the transition to Faraday.
|
data/lib/wasabi/document.rb
CHANGED
@@ -103,11 +103,13 @@ module Wasabi
|
|
103
103
|
@type_namespaces ||= begin
|
104
104
|
namespaces = []
|
105
105
|
|
106
|
-
parser.types.each do |
|
107
|
-
|
106
|
+
parser.types.each do |ns, types|
|
107
|
+
types.each do |type, info|
|
108
|
+
namespaces << [[type], info[:namespace]]
|
108
109
|
|
109
|
-
|
110
|
-
|
110
|
+
element_keys(info).each do |field|
|
111
|
+
namespaces << [[type, field], info[:namespace]]
|
112
|
+
end
|
111
113
|
end
|
112
114
|
end if document
|
113
115
|
|
@@ -119,12 +121,14 @@ module Wasabi
|
|
119
121
|
@type_definitions ||= begin
|
120
122
|
result = []
|
121
123
|
|
122
|
-
parser.types.each do |
|
123
|
-
|
124
|
-
|
125
|
-
|
124
|
+
parser.types.each do |ns, types|
|
125
|
+
types.each do |type, info|
|
126
|
+
element_keys(info).each do |field|
|
127
|
+
field_type = info[field][:type]
|
128
|
+
tag, namespace = field_type.split(":").reverse
|
126
129
|
|
127
|
-
|
130
|
+
result << [[type, field], tag] if user_defined(namespace)
|
131
|
+
end
|
128
132
|
end
|
129
133
|
end if document
|
130
134
|
|
data/lib/wasabi/parser.rb
CHANGED
@@ -181,44 +181,45 @@ module Wasabi
|
|
181
181
|
end
|
182
182
|
|
183
183
|
def process_type(namespace, type, name)
|
184
|
-
@types[
|
185
|
-
@types[
|
184
|
+
@types[namespace] ||= {}
|
185
|
+
@types[namespace][name] ||= { :namespace => namespace }
|
186
|
+
@types[namespace][name][:order!] = []
|
186
187
|
|
187
188
|
type.xpath('./xs:sequence/xs:element', 'xs' => XSD).each do |inner|
|
188
189
|
element_name = inner.attribute('name').to_s
|
189
|
-
@types[name][element_name] = { :type => inner.attribute('type').to_s }
|
190
|
+
@types[namespace][name][element_name] = { :type => inner.attribute('type').to_s }
|
190
191
|
|
191
192
|
[ :nillable, :minOccurs, :maxOccurs ].each do |attr|
|
192
193
|
if v = inner.attribute(attr.to_s)
|
193
|
-
@types[name][element_name][attr] = v.to_s
|
194
|
+
@types[namespace][name][element_name][attr] = v.to_s
|
194
195
|
end
|
195
196
|
end
|
196
197
|
|
197
|
-
@types[name][:order!] << element_name
|
198
|
+
@types[namespace][name][:order!] << element_name
|
198
199
|
end
|
199
200
|
|
200
201
|
type.xpath('./xs:complexContent/xs:extension/xs:sequence/xs:element', 'xs' => XSD).each do |inner_element|
|
201
202
|
element_name = inner_element.attribute('name').to_s
|
202
|
-
@types[name][element_name] = { :type => inner_element.attribute('type').to_s }
|
203
|
+
@types[namespace][name][element_name] = { :type => inner_element.attribute('type').to_s }
|
203
204
|
|
204
|
-
@types[name][:order!] << element_name
|
205
|
+
@types[namespace][name][:order!] << element_name
|
205
206
|
end
|
206
207
|
|
207
208
|
type.xpath('./xs:complexContent/xs:extension[@base]', 'xs' => XSD).each do |inherits|
|
208
209
|
base = inherits.attribute('base').value.match(/\w+$/).to_s
|
209
210
|
|
210
|
-
if @types[base]
|
211
|
+
if @types[namespace][base]
|
211
212
|
# Reverse merge because we don't want subclass attributes to be overriden by base class
|
212
|
-
@types[name] = types[base].merge(types[name])
|
213
|
-
@types[name][:order!] = @types[base][:order!] | @types[name][:order!]
|
214
|
-
@types[name][:base_type] = base
|
213
|
+
@types[namespace][name] = types[namespace][base].merge(types[namespace][name])
|
214
|
+
@types[namespace][name][:order!] = @types[namespace][base][:order!] | @types[namespace][name][:order!]
|
215
|
+
@types[namespace][name][:base_type] = base
|
215
216
|
else
|
216
217
|
p = Proc.new do
|
217
|
-
if @types[base]
|
218
|
+
if @types[namespace][base]
|
218
219
|
# Reverse merge because we don't want subclass attributes to be overriden by base class
|
219
|
-
@types[name] = @types[base].merge(@types[name])
|
220
|
-
@types[name][:order!] = @types[base][:order!] | @types[name][:order!]
|
221
|
-
@types[name][:base_type] = base
|
220
|
+
@types[namespace][name] = @types[namespace][base].merge(@types[namespace][name])
|
221
|
+
@types[namespace][name][:order!] = @types[namespace][base][:order!] | @types[namespace][name][:order!]
|
222
|
+
@types[namespace][name][:base_type] = base
|
222
223
|
end
|
223
224
|
end
|
224
225
|
deferred_types << p
|
@@ -238,6 +239,7 @@ module Wasabi
|
|
238
239
|
input_output_for(operation, 'output')
|
239
240
|
end
|
240
241
|
|
242
|
+
# @return [namespace_id, message_type]
|
241
243
|
def input_output_for(operation, input_output)
|
242
244
|
operation_name = operation['name']
|
243
245
|
|
@@ -250,9 +252,13 @@ module Wasabi
|
|
250
252
|
|
251
253
|
port_type_input_output = port_type_operation&.element_children&.find { |node| node.name == input_output }
|
252
254
|
|
255
|
+
# find the message for the portType operation
|
256
|
+
# if there is no message, we will use the operation name as the message name
|
257
|
+
|
253
258
|
# TODO: Stupid fix for missing support for imports.
|
254
259
|
# Sometimes portTypes are actually included in a separate WSDL.
|
255
260
|
if port_type_input_output
|
261
|
+
# If the message attribute contains a colon, it means the message is namespaced.
|
256
262
|
if port_type_input_output.attribute('message').to_s.include? ':'
|
257
263
|
port_message_ns_id, port_message_type = port_type_input_output.attribute('message').to_s.split(':')
|
258
264
|
else
|
@@ -261,13 +267,6 @@ module Wasabi
|
|
261
267
|
|
262
268
|
message_ns_id, message_type = nil
|
263
269
|
|
264
|
-
soap_operation = operation.element_children.find { |node| node.name == 'operation' }
|
265
|
-
|
266
|
-
if soap_operation.nil? || soap_operation['style'] != 'rpc'
|
267
|
-
message_ns_id = port_message_ns_id
|
268
|
-
message_type = port_message_type
|
269
|
-
end
|
270
|
-
|
271
270
|
# When there is a parts attribute in soap:body element, we should use that value
|
272
271
|
# to look up the message part from messages array.
|
273
272
|
input_output_element = operation.element_children.find { |node| node.name == input_output }
|
@@ -276,6 +275,7 @@ module Wasabi
|
|
276
275
|
soap_body_parts = soap_body_element['parts'] if soap_body_element
|
277
276
|
end
|
278
277
|
|
278
|
+
# look for any message part that matches the soap body parts
|
279
279
|
message = @messages[port_message_type]
|
280
280
|
port_message_part = message&.element_children&.find do |node|
|
281
281
|
soap_body_parts.nil? ? (node.name == "part") : (node.name == "part" && node["name"] == soap_body_parts)
|
@@ -290,6 +290,22 @@ module Wasabi
|
|
290
290
|
end
|
291
291
|
end
|
292
292
|
|
293
|
+
# If the message is not found, we should use the operation name as the message name for document style operations
|
294
|
+
# applies only to output
|
295
|
+
if input_output == 'output'
|
296
|
+
# if the operation is document style and theres no port_message_part, we should use the operation_name
|
297
|
+
soap_operation = operation.element_children.find { |node| node.name == 'operation' }
|
298
|
+
if message_type.nil? && (soap_operation.nil? || soap_operation['style'] != 'rpc')
|
299
|
+
if port_message_part.nil?
|
300
|
+
message_ns_id = port_message_ns_id
|
301
|
+
message_type = operation_name
|
302
|
+
else
|
303
|
+
message_ns_id = port_message_ns_id
|
304
|
+
message_type = port_message_type
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
293
309
|
# Fall back to the name of the binding operation
|
294
310
|
if message_type
|
295
311
|
[message_ns_id, message_type]
|
data/lib/wasabi/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wasabi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Harrington
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
22
|
+
version: '3'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.9'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
32
|
+
version: '3'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: nokogiri
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +79,7 @@ licenses:
|
|
73
79
|
- MIT
|
74
80
|
metadata:
|
75
81
|
changelog_uri: https://github.com/savonrb/wasabi/blob/master/CHANGELOG.md
|
76
|
-
documentation_uri: https://www.rubydoc.info/gems/wasabi/5.0
|
82
|
+
documentation_uri: https://www.rubydoc.info/gems/wasabi/5.1.0
|
77
83
|
source_code_uri: https://github.com/savonrb/wasabi
|
78
84
|
bug_tracker_uri: https://github.com/savonrb/wasabi/issues
|
79
85
|
rubygems_mfa_required: 'true'
|
@@ -92,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
98
|
- !ruby/object:Gem::Version
|
93
99
|
version: '0'
|
94
100
|
requirements: []
|
95
|
-
rubygems_version: 3.
|
101
|
+
rubygems_version: 3.4.10
|
96
102
|
signing_key:
|
97
103
|
specification_version: 4
|
98
104
|
summary: A simple WSDL parser
|