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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/rspec/openapi/schema_builder.rb +12 -2
- data/lib/rspec/openapi/schema_merger.rb +7 -0
- data/lib/rspec/openapi/version.rb +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: cd7d2eb0e69e2e60405a7d71d10acd3b2edf2d4db0358297a900200a0a69012e
|
4
|
+
data.tar.gz: 577545384d404ba11382ab4425e0bd40abeeb3e58db922e82d923f0d6d6ae8e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f60ee2cf93946405e3e151786965b3a0f68e53ad147a6d7613f59f46f834efd9a641d0f878943af934879d2f5e27e8c8d4cd55dac5288d62a85dc2b77009ddb
|
7
|
+
data.tar.gz: 7dc56150dfb4a8a5b526d7ec626b4ebc9c0680878cd1f976213490a489a598dfe2a285f01029e5a17cdbbe0d8b492fe79a2e51148ac24df94d532c404b0231fd
|
data/CHANGELOG.md
CHANGED
@@ -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
|
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
|
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
|
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.
|
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-
|
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.
|
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: []
|