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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf953519fd1b82b220dc55df8ac263dd12f260ad
4
- data.tar.gz: 61696eb4201f033a4c39daba75d56eb2052b9ff8
3
+ metadata.gz: 70532fd02f91610d9cb9dac9c2bc423c033dc3da
4
+ data.tar.gz: 9d942cd137b327ad9f8f9bc39ea621b81cd216fd
5
5
  SHA512:
6
- metadata.gz: ba2ae1c5751ec7ed740fd2572cb37e78b89c584c4fd42095f9a1c8076a3f72c49e2251905fbfd69fea7a3dd73dfa0a072299c09e21febc52574cca1224504929
7
- data.tar.gz: e886995f37ced2fe10457c1a6d8df03a3106eb9f08408a00e776b007d0048ac082c9362445a34c48685b77c4c1b5f619027b3f816ffb5b254f40bbe3e036ddf8
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 build_query(example)
21
+ def build_query_string(example)
22
22
  query_string = parameters_in(:query)
23
- .map { |p| "#{p[:name]}=#{example.send(p[:name])}" }
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
@@ -1,5 +1,5 @@
1
1
  module Rswag
2
2
  module Specs
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  end
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.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: :development
57
+ type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements: