wsdl_validator 0.1.8 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d2ec12d204a349daf90dc9839b67b986079dd304
4
- data.tar.gz: 2aa63bbe06189c30fe0edcf05ffa87cb2ae27b76
2
+ SHA256:
3
+ metadata.gz: '0397f50c93168cacf5bd628c661e8d3cfc5f8a2ce69eeb49b7e90fad6ff9b289'
4
+ data.tar.gz: c04b16e8863353ad60c93ad5a948e0fd53ae6b0feb054392b5ea2d0c5bf41194
5
5
  SHA512:
6
- metadata.gz: fdad29cc37bf6f4b7d90f2a76a56df60be4b786678aec21374df1bbf1ccf258dc5dbd9b13a2fae62d085f28687645db05c8fd14f0b003110283b7085566f2b6d
7
- data.tar.gz: 4733883570c6f93f93d730fbd755d13467acfe7b74c498e81153b0e2e4784eb939c0b8dab12a7a675b750a71ef5d035ad4beae2ec14563bb42c3fc47ecc87250
6
+ metadata.gz: e821760df7f679d5e23e4a20cf9ea3d030f8e2e8fc3ca8a0bd66e2db1a8e8b14b98424ae700d08d77bf4664a37b78f72fbfc6723651fb34b0b9db3d840e93eaa
7
+ data.tar.gz: 86d5eb2709e464691b607a6ade9b7eabe7a2a2babfa259939bffe0abbea69af742de986a8620db41b774bcac3e38420951d355462cba433df9b31ea31d36ca6f
data/.gitignore CHANGED
@@ -10,3 +10,5 @@
10
10
  Gemfile.lock
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+
14
+ logs
data/.gitlab-ci.yml CHANGED
@@ -1,14 +1,10 @@
1
- before_script:
2
- - apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
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
- - bundle exec rake spec
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
- - rspec
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
File without changes
@@ -1,3 +1,4 @@
1
1
  class WsdlValidator
2
- VERSION = '0.1.8'.freeze
2
+ # Version of Gem
3
+ VERSION = '0.2.0'.freeze
3
4
  end
@@ -18,10 +18,10 @@ class WsdlValidator
18
18
  self.show_schemas = parse_wsdl_schemas
19
19
  self.schemas = Nokogiri::XML::Schema(show_schemas)
20
20
  rescue Wasabi::Resolver::HTTPError => resolver
21
- raise WsdlValidator::Error, "Unauthorized for basic auth #{basic_auth}" if resolver.response.code == 401
21
+ raise WsdlValidator::Error, "Unauthorized for basic auth #{basic_auth}" if resolver.response.status == 401
22
22
  raise resolver
23
23
  rescue Nokogiri::XML::SyntaxError => syntax_error
24
- puts "Error for " + show_schemas
24
+ puts "Error for #{show_schemas}"
25
25
  raise syntax_error
26
26
  end
27
27
 
@@ -58,6 +58,11 @@ class WsdlValidator
58
58
 
59
59
  alias validate valid?
60
60
 
61
+ # @return [Hash] All namespaces defined throughout Wsdl
62
+ def namespaces
63
+ doc.parser.document.collect_namespaces
64
+ end
65
+
61
66
  private
62
67
 
63
68
  # Returns an Array with basic auth in it
@@ -77,24 +82,27 @@ class WsdlValidator
77
82
  def parse_wsdl_schemas
78
83
  doc.parser.schemas.collect do |schema|
79
84
  imports = schema.children.select { |child| child.name == 'import' }
80
- imported_xsds = imports.collect do |import|
81
- extract_schema_for(import)
82
- end.join
83
- if imported_xsds.empty?
84
- add_global_namespace_to(schema)
85
+ if imports.empty?
86
+ add_global_namespace_to schema
85
87
  else
86
- imported_schemas = Nokogiri::XML(imported_xsds).children
87
- updated_set = imported_schemas.collect { |imported_schema| add_global_namespace_to(imported_schema) }
88
- updated_set.join
89
- end.to_s
88
+ imported_xsds = imports.collect { |import| extract_schema_for(import) }.join
89
+ add_namespaces_to Nokogiri::XML(imported_xsds).children
90
+ end
90
91
  end.join
91
92
  end
92
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
+
93
101
  # Add namespaces from wsdl document to each schema
94
102
  # Sometimes schemas are defined there and referenced within the types
95
103
  # @return [String] String representing XML with global schemas added
96
104
  def add_global_namespace_to(schema)
97
- doc.parser.document.collect_namespaces.each { |namespace, value| schema[namespace] = value }
105
+ namespaces.each { |namespace, value| schema[namespace] = value }
98
106
  schema.to_s
99
107
  end
100
108
 
File without changes
@@ -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,8 +25,9 @@ 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', '~> 1.16'
30
- spec.add_development_dependency 'rake', '~> 10.0'
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
32
  spec.add_development_dependency 'savon'
33
33
  spec.add_development_dependency 'simplecov'
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.1.8
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: 2018-09-02 00:00:00.000000000 Z
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: '1.16'
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: '1.16'
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: '10.0'
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
81
  - !ruby/object:Gem::Version
82
- version: '10.0'
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
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -176,7 +190,7 @@ homepage: https://gitlab.com/samuel-garratt/wsdl_validator
176
190
  licenses:
177
191
  - MIT
178
192
  metadata: {}
179
- post_install_message:
193
+ post_install_message:
180
194
  rdoc_options: []
181
195
  require_paths:
182
196
  - lib
@@ -191,9 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
205
  - !ruby/object:Gem::Version
192
206
  version: '0'
193
207
  requirements: []
194
- rubyforge_project:
195
- rubygems_version: 2.6.14
196
- signing_key:
208
+ rubygems_version: 3.2.3
209
+ signing_key:
197
210
  specification_version: 4
198
211
  summary: Makes verifying a SOAP message against a WSDL easy.
199
212
  test_files: []