swagalicious 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -7
- data/lib/swagalicious/example_helpers.rb +1 -1
- data/lib/swagalicious/request_factory.rb +9 -8
- data/lib/swagalicious/version.rb +1 -1
- data/swagalicious.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4547f3c049b8fa0f79ef3f4619497942ffcdd6d10c4f84212fcba0a88ef5986
|
4
|
+
data.tar.gz: a3c03a1bc18b309c315fa7e6d6fca75297b8f8cd8c6c3fbfe58fa4fa25a31666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83bb5faf771075d0043d18e9221eab2c8be2c206d5002224a987167be39715838962629a62ca7b316509dc551966415bcf66caa2a7db9207b094a9db44488cd7
|
7
|
+
data.tar.gz: b30f7466d1f0c17b6e734d6453a2768310d742fcbec1aa65783acf04bb222ac3270c6a16f58abe366613bc1d8654f10866bc9bc59f0a87ce1c40f078077be2a1
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
swagalicious (1.
|
4
|
+
swagalicious (1.1.0)
|
5
5
|
faraday (~> 2.0)
|
6
6
|
faraday-rack
|
7
7
|
json-schema
|
8
8
|
oj (~> 3.11.0)
|
9
9
|
ox (~> 2.14.14)
|
10
|
-
rack-test
|
10
|
+
rack-test
|
11
11
|
rspec (~> 3)
|
12
12
|
|
13
13
|
GEM
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
minitest (>= 5.1)
|
20
20
|
tzinfo (~> 2.0)
|
21
21
|
zeitwerk (~> 2.3)
|
22
|
-
addressable (2.8.
|
22
|
+
addressable (2.8.5)
|
23
23
|
public_suffix (>= 2.0.2, < 6.0)
|
24
24
|
ast (2.4.2)
|
25
25
|
byebug (11.1.3)
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
diff-lcs (1.5.0)
|
29
29
|
factory_bot (6.1.0)
|
30
30
|
activesupport (>= 5.0.0)
|
31
|
-
faraday (2.7.
|
31
|
+
faraday (2.7.10)
|
32
32
|
faraday-net_http (>= 2.0, < 3.1)
|
33
33
|
ruby2_keywords (>= 0.0.4)
|
34
34
|
faraday-net_http (3.0.2)
|
@@ -37,7 +37,7 @@ GEM
|
|
37
37
|
i18n (1.10.0)
|
38
38
|
concurrent-ruby (~> 1.0)
|
39
39
|
json (2.6.3)
|
40
|
-
json-schema (
|
40
|
+
json-schema (4.0.0)
|
41
41
|
addressable (>= 2.8)
|
42
42
|
method_source (1.0.0)
|
43
43
|
minitest (5.16.1)
|
@@ -52,9 +52,9 @@ GEM
|
|
52
52
|
pry-byebug (3.9.0)
|
53
53
|
byebug (~> 11.0)
|
54
54
|
pry (~> 0.13.0)
|
55
|
-
public_suffix (5.0.
|
55
|
+
public_suffix (5.0.3)
|
56
56
|
rack (3.0.4.1)
|
57
|
-
rack-test (2.0
|
57
|
+
rack-test (2.1.0)
|
58
58
|
rack (>= 1.3)
|
59
59
|
rainbow (3.1.1)
|
60
60
|
rake (12.3.3)
|
@@ -100,7 +100,7 @@ class Swagalicious
|
|
100
100
|
(YAML.load(self.body) || {}).with_indifferent_access
|
101
101
|
when /xml/
|
102
102
|
(Ox.load(self.body, mode: :hash_no_attrs) || {}).with_indifferent_access
|
103
|
-
when "", nil
|
103
|
+
when "", nil, /html/
|
104
104
|
self.body
|
105
105
|
else
|
106
106
|
return unless raise_on_invalid
|
@@ -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(
|
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 |
|
148
|
+
rackified_tuples = tuples.map do |tuple|
|
149
149
|
[
|
150
|
-
case
|
150
|
+
case tuple[0]
|
151
151
|
when "Accept" then "HTTP_ACCEPT"
|
152
152
|
when "Content-Type" then "CONTENT_TYPE"
|
153
|
-
when "Authorization"
|
154
|
-
|
153
|
+
when "Authorization"
|
154
|
+
tuple[2] ? tuple[0] : "HTTP_AUTHORIZATION"
|
155
|
+
else tuple[0]
|
155
156
|
end,
|
156
|
-
|
157
|
+
tuple[1]
|
157
158
|
]
|
158
159
|
end
|
159
160
|
|
data/lib/swagalicious/version.rb
CHANGED
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"
|
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.
|
4
|
+
version: 1.1.1
|
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-
|
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:
|
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:
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|