rspec-openapi 0.3.17 → 0.3.18

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: 880f187fffd674c1abc266390cb70acedd726d09e947042286ce01b93b42f1f1
4
- data.tar.gz: f602dbac30374bd4efa06806f505b8a867172b6ea493bf6d3e3ce8b156ce8455
3
+ metadata.gz: cd7d2eb0e69e2e60405a7d71d10acd3b2edf2d4db0358297a900200a0a69012e
4
+ data.tar.gz: 577545384d404ba11382ab4425e0bd40abeeb3e58db922e82d923f0d6d6ae8e9
5
5
  SHA512:
6
- metadata.gz: 1a8b1611dea768d2bf7fa3c884d666d2635fec945dccda28ce8314e6557fe33b1c6315c8994953639f92ed181c61323a4c0a169670c2e47808aa9348f88a88a3
7
- data.tar.gz: 82602c1729a8299fb128bd3f31b9449369e4eef7744bf60da1a54f1de148b9eb36b1e7b2e85b423695e36e3b6a3c1de7fa2710b5bae2e194ba23371b719f29ac
6
+ metadata.gz: 5f60ee2cf93946405e3e151786965b3a0f68e53ad147a6d7613f59f46f834efd9a641d0f878943af934879d2f5e27e8c8d4cd55dac5288d62a85dc2b77009ddb
7
+ data.tar.gz: 7dc56150dfb4a8a5b526d7ec626b4ebc9c0680878cd1f976213490a489a598dfe2a285f01029e5a17cdbbe0d8b492fe79a2e51148ac24df94d532c404b0231fd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v0.3.18
2
+
3
+ * Support nested query parameters
4
+ [#29](https://github.com/k0kubun/rspec-openapi/pull/29)
5
+
1
6
  ## v0.3.17
2
7
 
3
8
  * Rescue NotImplementedError in the after suite hook as well
@@ -50,7 +50,7 @@ class << RSpec::OpenAPI::SchemaBuilder = Object.new
50
50
 
51
51
  record.path_params.each do |key, value|
52
52
  parameters << {
53
- name: key.to_s,
53
+ name: build_parameter_name(key, value),
54
54
  in: 'path',
55
55
  required: true,
56
56
  schema: build_property(try_cast(value)),
@@ -60,7 +60,7 @@ class << RSpec::OpenAPI::SchemaBuilder = Object.new
60
60
 
61
61
  record.query_params.each do |key, value|
62
62
  parameters << {
63
- name: key.to_s,
63
+ name: build_parameter_name(key, value),
64
64
  in: 'query',
65
65
  schema: build_property(try_cast(value)),
66
66
  example: (try_cast(value) if example_enabled?),
@@ -71,6 +71,16 @@ class << RSpec::OpenAPI::SchemaBuilder = Object.new
71
71
  parameters
72
72
  end
73
73
 
74
+ def build_parameter_name(key, value)
75
+ key = key.to_s
76
+ if value.is_a?(Hash) && (value_keys = value.keys).size == 1
77
+ value_key = value_keys.first
78
+ build_parameter_name("#{key}[#{value_key}]", value[value_key])
79
+ else
80
+ key
81
+ end
82
+ end
83
+
74
84
  def build_request_body(record)
75
85
  return nil if record.request_content_type.nil?
76
86
  return nil if record.request_params.empty?
@@ -30,6 +30,13 @@ class << RSpec::OpenAPI::SchemaMerger = Object.new
30
30
  deep_reverse_merge!(base[key], value)
31
31
  elsif !base.key?(key)
32
32
  base[key] = value
33
+ elsif base[key].is_a?(Array) && value.is_a?(Array)
34
+ if key == "parameters"
35
+ # merge arrays
36
+ base[key] |= value
37
+ end
38
+ else
39
+ # no-op
33
40
  end
34
41
  end
35
42
  base
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module OpenAPI
3
- VERSION = '0.3.17'
3
+ VERSION = '0.3.18'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-openapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.17
4
+ version: 0.3.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-15 00:00:00.000000000 Z
11
+ date: 2021-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -75,7 +75,7 @@ metadata:
75
75
  homepage_uri: https://github.com/k0kubun/rspec-openapi
76
76
  source_code_uri: https://github.com/k0kubun/rspec-openapi
77
77
  changelog_uri: https://github.com/k0kubun/rspec-openapi/blob/master/CHANGELOG.md
78
- post_install_message:
78
+ post_install_message:
79
79
  rdoc_options: []
80
80
  require_paths:
81
81
  - lib
@@ -90,8 +90,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubygems_version: 3.1.6
94
- signing_key:
93
+ rubygems_version: 3.1.2
94
+ signing_key:
95
95
  specification_version: 4
96
96
  summary: Generate OpenAPI schema from RSpec request specs
97
97
  test_files: []