wsdl_validator 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.gitlab-ci.yml +7 -11
- data/.rspec +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +6 -0
- data/Rakefile +0 -0
- data/lib/wsdl_validator/error.rb +0 -0
- data/lib/wsdl_validator/version.rb +2 -1
- data/lib/wsdl_validator/wsdl_validator.rb +33 -9
- data/lib/wsdl_validator.rb +0 -0
- data/wsdl_validator.gemspec +4 -3
- metadata +42 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '0397f50c93168cacf5bd628c661e8d3cfc5f8a2ce69eeb49b7e90fad6ff9b289'
|
4
|
+
data.tar.gz: c04b16e8863353ad60c93ad5a948e0fd53ae6b0feb054392b5ea2d0c5bf41194
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e821760df7f679d5e23e4a20cf9ea3d030f8e2e8fc3ca8a0bd66e2db1a8e8b14b98424ae700d08d77bf4664a37b78f72fbfc6723651fb34b0b9db3d840e93eaa
|
7
|
+
data.tar.gz: 86d5eb2709e464691b607a6ade9b7eabe7a2a2babfa259939bffe0abbea69af742de986a8620db41b774bcac3e38420951d355462cba433df9b31ea31d36ca6f
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
- ruby -v
|
4
|
-
- which ruby
|
5
|
-
- gem install bundler rake --no-ri --no-rdoc
|
6
|
-
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
7
|
-
|
8
|
-
rspec:
|
1
|
+
test:
|
2
|
+
image: ruby:3.3
|
9
3
|
stage: test
|
10
4
|
script:
|
11
|
-
-
|
5
|
+
- gem install bundler rake
|
6
|
+
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
7
|
+
- bundle exec rake
|
12
8
|
artifacts:
|
13
9
|
paths:
|
14
10
|
- coverage/
|
@@ -16,7 +12,7 @@ rspec:
|
|
16
12
|
pages:
|
17
13
|
stage: deploy
|
18
14
|
dependencies:
|
19
|
-
-
|
15
|
+
- test
|
20
16
|
script:
|
21
17
|
- mv coverage/ public/
|
22
18
|
artifacts:
|
@@ -24,4 +20,4 @@ pages:
|
|
24
20
|
- public
|
25
21
|
expire_in: 30 days
|
26
22
|
only:
|
27
|
-
- master
|
23
|
+
- master
|
data/.rspec
CHANGED
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -30,6 +30,12 @@ wsdl.valid? xml_message
|
|
30
30
|
```
|
31
31
|
=> Returns true or raises an exception
|
32
32
|
|
33
|
+
## Todo
|
34
|
+
|
35
|
+
Validate
|
36
|
+
|
37
|
+
* Including the SOAP header/body message structure.
|
38
|
+
|
33
39
|
## Development
|
34
40
|
|
35
41
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
File without changes
|
data/lib/wsdl_validator/error.rb
CHANGED
File without changes
|
@@ -17,9 +17,12 @@ class WsdlValidator
|
|
17
17
|
self.doc = Wasabi.document wsdl_url
|
18
18
|
self.show_schemas = parse_wsdl_schemas
|
19
19
|
self.schemas = Nokogiri::XML::Schema(show_schemas)
|
20
|
-
rescue Wasabi::Resolver::HTTPError =>
|
21
|
-
raise WsdlValidator::Error, "Unauthorized for basic auth #{basic_auth}" if
|
22
|
-
raise
|
20
|
+
rescue Wasabi::Resolver::HTTPError => resolver
|
21
|
+
raise WsdlValidator::Error, "Unauthorized for basic auth #{basic_auth}" if resolver.response.status == 401
|
22
|
+
raise resolver
|
23
|
+
rescue Nokogiri::XML::SyntaxError => syntax_error
|
24
|
+
puts "Error for #{show_schemas}"
|
25
|
+
raise syntax_error
|
23
26
|
end
|
24
27
|
|
25
28
|
# Gets the namespaces from the SOAP Envelope & Body element, adds them to the root element underneath the body
|
@@ -55,6 +58,11 @@ class WsdlValidator
|
|
55
58
|
|
56
59
|
alias validate valid?
|
57
60
|
|
61
|
+
# @return [Hash] All namespaces defined throughout Wsdl
|
62
|
+
def namespaces
|
63
|
+
doc.parser.document.collect_namespaces
|
64
|
+
end
|
65
|
+
|
58
66
|
private
|
59
67
|
|
60
68
|
# Returns an Array with basic auth in it
|
@@ -70,18 +78,34 @@ class WsdlValidator
|
|
70
78
|
end
|
71
79
|
|
72
80
|
# Join all the schemas within the WSDL, importing schemas if necessary
|
73
|
-
# @return [String]
|
81
|
+
# @return [String] Schema XML contained within WSDL
|
74
82
|
def parse_wsdl_schemas
|
75
83
|
doc.parser.schemas.collect do |schema|
|
76
84
|
imports = schema.children.select { |child| child.name == 'import' }
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
85
|
+
if imports.empty?
|
86
|
+
add_global_namespace_to schema
|
87
|
+
else
|
88
|
+
imported_xsds = imports.collect { |import| extract_schema_for(import) }.join
|
89
|
+
add_namespaces_to Nokogiri::XML(imported_xsds).children
|
90
|
+
end
|
82
91
|
end.join
|
83
92
|
end
|
84
93
|
|
94
|
+
# For each of the schemas add the namespaces defined in the WSDL
|
95
|
+
# @param [Nokogiri::XML::NodeSet] schemas Xsd schemas
|
96
|
+
# @return [String] Add namespaces from WSDL to each schema passed
|
97
|
+
def add_namespaces_to(schemas)
|
98
|
+
schemas.collect { |schema| add_global_namespace_to(schema) }.join
|
99
|
+
end
|
100
|
+
|
101
|
+
# Add namespaces from wsdl document to each schema
|
102
|
+
# Sometimes schemas are defined there and referenced within the types
|
103
|
+
# @return [String] String representing XML with global schemas added
|
104
|
+
def add_global_namespace_to(schema)
|
105
|
+
namespaces.each { |namespace, value| schema[namespace] = value }
|
106
|
+
schema.to_s
|
107
|
+
end
|
108
|
+
|
85
109
|
# Makes a GET request returning the xsd from the defined location
|
86
110
|
# @return [String] Schema from location defined in 'schemaLocation' attribute
|
87
111
|
def extract_schema_for(import)
|
data/lib/wsdl_validator.rb
CHANGED
File without changes
|
data/wsdl_validator.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'wsdl_validator/version'
|
@@ -26,9 +25,11 @@ Gem::Specification.new do |spec|
|
|
26
25
|
spec.add_dependency 'nokogiri'
|
27
26
|
spec.add_dependency 'wasabi'
|
28
27
|
|
29
|
-
spec.add_development_dependency 'bundler'
|
30
|
-
spec.add_development_dependency 'rake'
|
28
|
+
spec.add_development_dependency 'bundler'
|
29
|
+
spec.add_development_dependency 'rake'
|
30
|
+
spec.add_development_dependency 'rackup'
|
31
31
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
32
|
+
spec.add_development_dependency 'savon'
|
32
33
|
spec.add_development_dependency 'simplecov'
|
33
34
|
spec.add_development_dependency 'sinatra'
|
34
35
|
spec.add_development_dependency 'sinatra-basic-auth'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wsdl_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Garratt
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpi
|
@@ -56,30 +56,44 @@ dependencies:
|
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rackup
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '3.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: savon
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: simplecov
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +190,7 @@ homepage: https://gitlab.com/samuel-garratt/wsdl_validator
|
|
162
190
|
licenses:
|
163
191
|
- MIT
|
164
192
|
metadata: {}
|
165
|
-
post_install_message:
|
193
|
+
post_install_message:
|
166
194
|
rdoc_options: []
|
167
195
|
require_paths:
|
168
196
|
- lib
|
@@ -177,9 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
205
|
- !ruby/object:Gem::Version
|
178
206
|
version: '0'
|
179
207
|
requirements: []
|
180
|
-
|
181
|
-
|
182
|
-
signing_key:
|
208
|
+
rubygems_version: 3.2.3
|
209
|
+
signing_key:
|
183
210
|
specification_version: 4
|
184
211
|
summary: Makes verifying a SOAP message against a WSDL easy.
|
185
212
|
test_files: []
|