swagalicious 0.5.2 → 0.5.3

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: 89c4466d6c9ea1d244b293d16b86edf9f1611b3c9fd0f6057cd3dcf63a8328ed
4
- data.tar.gz: 0e879d017afc95a8a4f0f27a02e0dad9650eb2eefb07c468d8b732c2149ef70f
3
+ metadata.gz: e5ca94c771cd7880a7ca5067494dbeb2191f24135cac0632a1a80b4b446b44c5
4
+ data.tar.gz: 50be7a011f75c16a812d7674ab226abe1506b20e08f86e8d9f9385887bb4c9f2
5
5
  SHA512:
6
- metadata.gz: 2de2c29b4bb1dd5a19fed86010160a445b5f4add5a05a01608761704101f502173dc537c863d7cff8577cac0b8047d7c74a8d4018bfaed1ec61bb63af0918e07
7
- data.tar.gz: ec3740df707edf4485ed2d50294f6a696bec691541f102c4b63094e9218d5973a8406299570eb642d10721867073858e41919e40e1a96fb8f5674ea318021b84
6
+ metadata.gz: 11eaddf8649effe8652269a2257a9438c766960c59e00d406172daa33639b10a4ba9bae05f6d792d3ca7feb4602c4a230e0c13cc7489e45d771496a3679f9a19
7
+ data.tar.gz: 9f187376ca50e6ea1333c432c88cbb872f6c0ba841be7018957624b5c01105bb7b4b897483ab45503f37e8b80c42abf3d0c5613f8b65b8fc84eec3a70539a37e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swagalicious (0.5.0)
4
+ swagalicious (0.5.3)
5
5
  faraday (~> 2.0)
6
6
  faraday-rack
7
7
  json-schema
@@ -26,10 +26,10 @@ GEM
26
26
  diff-lcs (1.5.0)
27
27
  factory_bot (6.1.0)
28
28
  activesupport (>= 5.0.0)
29
- faraday (2.5.2)
29
+ faraday (2.7.3)
30
30
  faraday-net_http (>= 2.0, < 3.1)
31
31
  ruby2_keywords (>= 0.0.4)
32
- faraday-net_http (3.0.0)
32
+ faraday-net_http (3.0.2)
33
33
  faraday-rack (2.0.0)
34
34
  faraday (~> 2.0)
35
35
  i18n (1.10.0)
@@ -45,8 +45,8 @@ GEM
45
45
  pry-byebug (3.9.0)
46
46
  byebug (~> 11.0)
47
47
  pry (~> 0.13.0)
48
- public_suffix (5.0.0)
49
- rack (3.0.0)
48
+ public_suffix (5.0.1)
49
+ rack (3.0.4.1)
50
50
  rack-test (2.0.2)
51
51
  rack (>= 1.3)
52
52
  rake (12.3.3)
@@ -79,4 +79,4 @@ DEPENDENCIES
79
79
  swagalicious!
80
80
 
81
81
  BUNDLED WITH
82
- 2.3.20
82
+ 2.3.17
@@ -57,8 +57,10 @@ class Swagalicious
57
57
  end
58
58
 
59
59
  def header(name, attributes)
60
- metadata[:response][:headers] ||= {}
61
- metadata[:response][:headers][name] = attributes
60
+ header_name = attributes.delete(:variable) || name
61
+
62
+ metadata[:response][:headers] ||= {}
63
+ metadata[:response][:headers][header_name] = attributes
62
64
  end
63
65
 
64
66
  # NOTE: Similar to 'description', 'examples' need to handle the case when
@@ -91,12 +91,14 @@ class Swagalicious
91
91
 
92
92
  request[:path] = template.tap do |path_template|
93
93
  parameters.select { |p| p[:in] == :path }.each do |p|
94
- path_template.gsub!("{#{p[:name]}}", example.send(p[:name]).to_s)
94
+ variable_name = p[:variable_name] || p[:name]
95
+ path_template.gsub!("{#{p[:name]}}", example.send(variable_name).to_s)
95
96
  end
96
97
 
97
98
  parameters.select { |p| p[:in] == :query }.each_with_index do |p, i|
99
+ variable_name = p[:variable_name] || p[:name]
98
100
  path_template.concat(i.zero? ? "?" : "&")
99
- path_template.concat(build_query_string_part(p, example.send(p[:name])))
101
+ path_template.concat(build_query_string_part(p, example.send(variable_name)))
100
102
  end
101
103
  end
102
104
  end
@@ -122,7 +124,11 @@ class Swagalicious
122
124
  def add_headers(request, metadata, swagger_doc, parameters, example)
123
125
  tuples = parameters
124
126
  .select { |p| p[:in] == :header }
125
- .map { |p| [p[:name], example.send(p[:name]).to_s] }
127
+ .map do |p|
128
+ variable_name = p[:variable_name] || p[:name]
129
+
130
+ [p[:name], example.send(variable_name).to_s]
131
+ end
126
132
 
127
133
  # Accept header
128
134
  produces = metadata[:operation][:produces] || swagger_doc[:produces]
@@ -55,7 +55,7 @@ class Swagalicious
55
55
  private
56
56
 
57
57
  def pretty_generate(doc)
58
- if config.swagger_format == :yaml
58
+ if config.swagger_format == :yaml || doc.delete(:swagger_format) == :yaml
59
59
  clean_doc = yaml_prepare(doc)
60
60
  YAML.dump(clean_doc)
61
61
  else # config errors are thrown in "def swagger_format", no throw needed here
@@ -1,3 +1,3 @@
1
1
  class Swagalicious
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
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: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Howe
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-14 00:00:00.000000000 Z
11
+ date: 2023-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -160,7 +160,7 @@ metadata:
160
160
  allowed_push_host: https://rubygems.org
161
161
  homepage_uri: https://github.com/ehowe/swagalicious
162
162
  source_code_uri: https://github.com/ehowe/swagalicious
163
- post_install_message:
163
+ post_install_message:
164
164
  rdoc_options: []
165
165
  require_paths:
166
166
  - lib
@@ -175,8 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.0.3.1
179
- signing_key:
178
+ rubygems_version: 3.2.33
179
+ signing_key:
180
180
  specification_version: 4
181
181
  summary: RSwag without Rails
182
182
  test_files: []