wasabi 2.2.0 → 2.3.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.
- data/CHANGELOG.md +4 -0
- data/lib/wasabi/parser.rb +30 -0
- data/lib/wasabi/version.rb +1 -1
- data/spec/fixtures/inherited.wsdl +46 -0
- data/spec/wasabi/document/inherited_spec.rb +18 -0
- metadata +8 -4
data/CHANGELOG.md
CHANGED
data/lib/wasabi/parser.rb
CHANGED
@@ -16,6 +16,7 @@ module Wasabi
|
|
16
16
|
self.operations = {}
|
17
17
|
self.namespaces = {}
|
18
18
|
self.types = {}
|
19
|
+
self.deferred_types = []
|
19
20
|
self.element_form_default = :unqualified
|
20
21
|
end
|
21
22
|
|
@@ -34,6 +35,9 @@ module Wasabi
|
|
34
35
|
# Returns a map from a type name to a Hash with type information.
|
35
36
|
attr_accessor :types
|
36
37
|
|
38
|
+
# Returns a map of deferred type Proc objects.
|
39
|
+
attr_accessor :deferred_types
|
40
|
+
|
37
41
|
# Returns the SOAP endpoint.
|
38
42
|
attr_accessor :endpoint
|
39
43
|
|
@@ -45,6 +49,7 @@ module Wasabi
|
|
45
49
|
parse_endpoint
|
46
50
|
parse_operations
|
47
51
|
parse_types
|
52
|
+
parse_deferred_types
|
48
53
|
end
|
49
54
|
|
50
55
|
def parse_namespaces
|
@@ -108,6 +113,31 @@ module Wasabi
|
|
108
113
|
|
109
114
|
xpath(type, "./xs:sequence/xs:element").
|
110
115
|
each { |inner| @types[name][inner.attribute("name").to_s] = { :type => inner.attribute("type").to_s } }
|
116
|
+
|
117
|
+
type.xpath("./xs:complexContent/xs:extension/xs:sequence/xs:element",
|
118
|
+
"xs" => "http://www.w3.org/2001/XMLSchema"
|
119
|
+
).each do |inner_element|
|
120
|
+
@types[name][inner_element.attribute('name').to_s] = {
|
121
|
+
:type => inner_element.attribute('type').to_s
|
122
|
+
}
|
123
|
+
end
|
124
|
+
|
125
|
+
type.xpath('./xs:complexContent/xs:extension[@base]',
|
126
|
+
"xs" => "http://www.w3.org/2001/XMLSchema"
|
127
|
+
).each do |inherits|
|
128
|
+
base = inherits.attribute('base').value.match(/\w+$/).to_s
|
129
|
+
if @types[base]
|
130
|
+
@types[name].merge! @types[base]
|
131
|
+
else
|
132
|
+
deferred_types << Proc.new do
|
133
|
+
@types[name].merge! @types[base]
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def parse_deferred_types
|
140
|
+
deferred_types.each(&:call)
|
111
141
|
end
|
112
142
|
|
113
143
|
def find_namespace(type)
|
data/lib/wasabi/version.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
|
3
|
+
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
|
4
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
5
|
+
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
6
|
+
xmlns:ens="http://api.example.com/"
|
7
|
+
xmlns:ons="http://object.api.example.com/"
|
8
|
+
xmlns:fns="http://fault.api.example.com/"
|
9
|
+
targetNamespace="http://api.example.com/">
|
10
|
+
<types>
|
11
|
+
<schema attributeFormDefault="qualified" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://object.api.example.com/">
|
12
|
+
<complexType name="Account">
|
13
|
+
<complexContent>
|
14
|
+
<extension base="ons:baseObject">
|
15
|
+
<sequence>
|
16
|
+
<element minOccurs="0" name="Description" nillable="true" type="string" />
|
17
|
+
<element minOccurs="0" name="ProcessId" nillable="true" type="ens:ID" />
|
18
|
+
<element minOccurs="0" name="CreatedDate" nillable="true" type="dateTime" />
|
19
|
+
</sequence>
|
20
|
+
</extension>
|
21
|
+
</complexContent>
|
22
|
+
</complexType>
|
23
|
+
<complexType name="baseObject">
|
24
|
+
<sequence>
|
25
|
+
<element minOccurs="0" maxOccurs="unbounded" name="fieldsToNull" nillable="true" type="string" />
|
26
|
+
<element minOccurs="0" maxOccurs="1" name="Id" nillable="true" type="ens:ID" />
|
27
|
+
</sequence>
|
28
|
+
</complexType>
|
29
|
+
</schema>
|
30
|
+
|
31
|
+
<schema attributeFormDefault="qualified" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://api.example.com/">
|
32
|
+
<simpleType name="ID">
|
33
|
+
<restriction base="xs:string">
|
34
|
+
<pattern value='[a-zA-Z0-9]{32}|\d+' />
|
35
|
+
</restriction>
|
36
|
+
</simpleType>
|
37
|
+
<element name="DummyHeader">
|
38
|
+
<complexType>
|
39
|
+
<sequence>
|
40
|
+
<element minOccurs="0" name="Account" nillable="true" type="ons:Account" />
|
41
|
+
</sequence>
|
42
|
+
</complexType>
|
43
|
+
</element>
|
44
|
+
</schema>
|
45
|
+
</types>
|
46
|
+
</definitions>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Wasabi::Document do
|
4
|
+
context "with: inherited.xml" do
|
5
|
+
|
6
|
+
subject { Wasabi::Document.new fixture(:inherited) }
|
7
|
+
|
8
|
+
its(:type_definitions) do
|
9
|
+
should include([["Account", "Id"], "ID"])
|
10
|
+
should include([["Account", "ProcessId"], "ID"])
|
11
|
+
should include([["Account", "CreatedDate"], "dateTime"])
|
12
|
+
should include([["Account", "Description"], "string"])
|
13
|
+
should include([["Account", "fieldsToNull"], "string"])
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wasabi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 2.
|
10
|
+
version: 2.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Harrington
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-06-
|
18
|
+
date: 2012-06-07 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/wasabi/xpath_helper.rb
|
106
106
|
- spec/fixtures/authentication.wsdl
|
107
107
|
- spec/fixtures/geotrust.wsdl
|
108
|
+
- spec/fixtures/inherited.wsdl
|
108
109
|
- spec/fixtures/lower_camel.wsdl
|
109
110
|
- spec/fixtures/multiple_namespaces.wsdl
|
110
111
|
- spec/fixtures/multiple_types.wsdl
|
@@ -119,6 +120,7 @@ files:
|
|
119
120
|
- spec/wasabi/core_ext/string_spec.rb
|
120
121
|
- spec/wasabi/document/authentication_spec.rb
|
121
122
|
- spec/wasabi/document/geotrust_spec.rb
|
123
|
+
- spec/wasabi/document/inherited_spec.rb
|
122
124
|
- spec/wasabi/document/multiple_namespaces_spec.rb
|
123
125
|
- spec/wasabi/document/namespaced_actions_spec.rb
|
124
126
|
- spec/wasabi/document/no_namespace_spec.rb
|
@@ -167,6 +169,7 @@ summary: A simple WSDL parser
|
|
167
169
|
test_files:
|
168
170
|
- spec/fixtures/authentication.wsdl
|
169
171
|
- spec/fixtures/geotrust.wsdl
|
172
|
+
- spec/fixtures/inherited.wsdl
|
170
173
|
- spec/fixtures/lower_camel.wsdl
|
171
174
|
- spec/fixtures/multiple_namespaces.wsdl
|
172
175
|
- spec/fixtures/multiple_types.wsdl
|
@@ -181,6 +184,7 @@ test_files:
|
|
181
184
|
- spec/wasabi/core_ext/string_spec.rb
|
182
185
|
- spec/wasabi/document/authentication_spec.rb
|
183
186
|
- spec/wasabi/document/geotrust_spec.rb
|
187
|
+
- spec/wasabi/document/inherited_spec.rb
|
184
188
|
- spec/wasabi/document/multiple_namespaces_spec.rb
|
185
189
|
- spec/wasabi/document/namespaced_actions_spec.rb
|
186
190
|
- spec/wasabi/document/no_namespace_spec.rb
|