rswag-specs 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rswag/specs/request_factory.rb +22 -4
- data/lib/rswag/specs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70532fd02f91610d9cb9dac9c2bc423c033dc3da
|
4
|
+
data.tar.gz: 9d942cd137b327ad9f8f9bc39ea621b81cd216fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b415fc36ed7894301fd2e037b419dd9df53108fe24bfc64af9bb4d65be9a2221f9f30029d6936bf79868a0151f58b26e4a21536a919450c74a9af14c9c8831f
|
7
|
+
data.tar.gz: 4bd4fefe965d56f2afab78b35278b84c492f53a9b44423e93cf97a2a287166ec87a8776913e899d159f77fc8b5740e55b0588400fc1f1467352758b3b9f983c6
|
@@ -12,15 +12,15 @@ module Rswag
|
|
12
12
|
|
13
13
|
def build_fullpath(example)
|
14
14
|
@api_metadata[:path].dup.tap do |t|
|
15
|
-
parameters_in(:path).each { |p| t.gsub!("{#{p[:name]}}", example.send(p[:name]).to_s) }
|
16
|
-
t.concat(build_query(example))
|
17
15
|
t.prepend(@global_metadata[:basePath] || '')
|
16
|
+
parameters_in(:path).each { |p| t.gsub!("{#{p[:name]}}", example.send(p[:name]).to_s) }
|
17
|
+
t.concat(build_query_string(example))
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
21
|
+
def build_query_string(example)
|
22
22
|
query_string = parameters_in(:query)
|
23
|
-
.map { |p|
|
23
|
+
.map { |p| build_query_string_part(p, example.send(p[:name])) }
|
24
24
|
.join('&')
|
25
25
|
|
26
26
|
query_string.empty? ? '' : "?#{query_string}"
|
@@ -65,6 +65,24 @@ module Rswag
|
|
65
65
|
definitions.values.select { |d| d[:type] == :apiKey }
|
66
66
|
end
|
67
67
|
end
|
68
|
+
|
69
|
+
def build_query_string_part(param, value)
|
70
|
+
return "#{param[:name]}=#{value.to_s}" unless param[:type].to_sym == :array
|
71
|
+
|
72
|
+
name = param[:name]
|
73
|
+
case param[:collectionFormat]
|
74
|
+
when :ssv
|
75
|
+
"#{name}=#{value.join(' ')}"
|
76
|
+
when :tsv
|
77
|
+
"#{name}=#{value.join('\t')}"
|
78
|
+
when :pipes
|
79
|
+
"#{name}=#{value.join('|')}"
|
80
|
+
when :multi
|
81
|
+
value.map { |v| "#{name}=#{v}" }.join('&')
|
82
|
+
else
|
83
|
+
"#{name}=#{value.join(',')}" # csv is default
|
84
|
+
end
|
85
|
+
end
|
68
86
|
end
|
69
87
|
end
|
70
88
|
end
|
data/lib/rswag/specs/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rswag-specs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richie Morris
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
- - "<"
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '4'
|
57
|
-
type: :
|
57
|
+
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|