swagalicious 1.0.0 → 1.1.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
2
  SHA256:
3
- metadata.gz: abb72dfd425ef772e7d2c0cf1ac1079d60cf9d6310b790dc9eef4454e145d7dd
4
- data.tar.gz: 3c919667c104eba4d2e01d4177e68e4bcc5d57a8a0d33ee02b9fcfa79d3cf899
3
+ metadata.gz: 7b591f97affd8dc1fa23c0ba79eb43aeccfc0b954d6a8eb8a3dbaae10d4e5da8
4
+ data.tar.gz: 6d5b20f69b8543406a99e5d1e59848d02b1299558f14be5f9023e473a7b1e903
5
5
  SHA512:
6
- metadata.gz: 12939af351eaebed0316bff2af98b58fcf7f39041311920bab9338f163e5dc06d2575148fedcb22ab92581f91b9f9d8e28dbffb0bef60cc97faccc2a97bf9718
7
- data.tar.gz: 8003706edc0671b7cce79a72d9098827de9d114b0d42502684ea980bf4ee22deab1a998603710a82a55321fa0c318b42414d7f047ae5a2028214ae2a8354a647
6
+ metadata.gz: 233c014d7df4f7625275193eda7fe58ae8cfd7ad3dea95ce8a4e19aabad3d9b9ef4ad082042bc4ba873d698a64b0b262298f2859fc13f1408729462dc478a6dc
7
+ data.tar.gz: 93f9dcb0fb104aaac7a54cfbda195dcd27d8b47598f7176cc65f6b5b0f0ac6b260f2f760ee7b9355ad429c91c1ebf164bff5ae28c7aace7686559ea9b89b6095
data/Gemfile.lock CHANGED
@@ -7,7 +7,7 @@ PATH
7
7
  json-schema
8
8
  oj (~> 3.11.0)
9
9
  ox (~> 2.14.14)
10
- rack-test (~> 2.0.2)
10
+ rack-test
11
11
  rspec (~> 3)
12
12
 
13
13
  GEM
@@ -35,11 +35,11 @@ class Swagalicious
35
35
 
36
36
  def derive_security_params(metadata, swagger_doc)
37
37
  requirements = metadata[:operation][:security] || swagger_doc[:security] || []
38
- scheme_names = requirements.flat_map(&:keys)
38
+ scheme_names = requirements.flat_map { |r| r.has_key?(:type) ? r[:type] : r.keys }
39
39
  schemes = security_version(scheme_names, swagger_doc)
40
40
 
41
41
  schemes.map do |scheme|
42
- param = (scheme[:type] == :apiKey) ? scheme.slice(:name, :in, :required) : { name: "Authorization", in: :header }
42
+ param = (scheme[:type] == :apiKey) ? scheme.slice(:name, :in, :required, :force_name) : { name: "Authorization", in: :header }
43
43
  param.merge(required: requirements.one?) unless param.has_key?(:required)
44
44
  param.merge(type: :string)
45
45
  end
@@ -127,7 +127,7 @@ class Swagalicious
127
127
  .map do |p|
128
128
  variable_name = p[:variable_name] || p[:name]
129
129
 
130
- [p[:name], example.send(variable_name).to_s]
130
+ [p[:name], example.send(variable_name).to_s, p[:force_name]]
131
131
  end
132
132
 
133
133
  # Accept header
@@ -145,15 +145,16 @@ class Swagalicious
145
145
  end
146
146
 
147
147
  # Rails test infrastructure requires rackified headers
148
- rackified_tuples = tuples.map do |pair|
148
+ rackified_tuples = tuples.map do |tuple|
149
149
  [
150
- case pair[0]
150
+ case tuple[0]
151
151
  when "Accept" then "HTTP_ACCEPT"
152
152
  when "Content-Type" then "CONTENT_TYPE"
153
- when "Authorization" then "HTTP_AUTHORIZATION"
154
- else pair[0]
153
+ when "Authorization"
154
+ tuple[2] ? tuple[0] : "HTTP_AUTHORIZATION"
155
+ else tuple[0]
155
156
  end,
156
- pair[1]
157
+ tuple[1]
157
158
  ]
158
159
  end
159
160
 
@@ -1,3 +1,3 @@
1
1
  class Swagalicious
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
data/swagalicious.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency "json-schema"
30
30
  spec.add_dependency "oj", "~> 3.11.0"
31
31
  spec.add_dependency "ox", "~> 2.14.14"
32
- spec.add_dependency "rack-test", "~> 2.0.2"
32
+ spec.add_dependency "rack-test"
33
33
  spec.add_dependency "rspec", "~> 3"
34
34
 
35
35
  spec.add_development_dependency "rubocop", "~> 1.48.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagalicious
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Howe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-07 00:00:00.000000000 Z
11
+ date: 2023-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: rack-test
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 2.0.2
89
+ version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 2.0.2
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement