openapi_parameters 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +3 -3
- data/lib/openapi_parameters/converter.rb +11 -7
- data/lib/openapi_parameters/parameter.rb +1 -1
- data/lib/openapi_parameters/query.rb +1 -1
- data/lib/openapi_parameters/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce377792c0096d9aba455f83d129162c636f6cab951e43221de7dfbfb9e67227
|
4
|
+
data.tar.gz: e8f320696d3af924bd25496c6f98e19222af638365bfd39d5199b0da27104002
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67bf514be29731af8936dbab3ec1dfcb61b1091332487f4602c56bab7a708dd9637925b8e58c819d9d39d75e4bf861800dfaf407608837f846f2ed3b09f6cf2d
|
7
|
+
data.tar.gz: cf4f96c5a4e0f4c0b025eaa116dd3e38d040f6e1ef2be0cde8b3a2b1f871d5b027454ed1d57ca69ccb3310ae84162488c4111797985cf9ec3a0b321c2f30d717
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.3.2] - 2023-11-14
|
4
|
+
|
5
|
+
- Assume that schemas with `properties` or `style: deepObject` describe Objects and therefore convert it's values.
|
6
|
+
|
3
7
|
## [0.3.1] - 2023-11-09
|
8
|
+
|
4
9
|
- Make it work with Zeitwerk's `eager_load`
|
5
10
|
|
6
11
|
## [0.3.0] - 2023-10-27
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
openapi_parameters (0.3.
|
4
|
+
openapi_parameters (0.3.2)
|
5
5
|
rack (>= 2.2)
|
6
6
|
zeitwerk (~> 2.6)
|
7
7
|
|
@@ -19,12 +19,12 @@ GEM
|
|
19
19
|
parser (3.2.2.4)
|
20
20
|
ast (~> 2.4.1)
|
21
21
|
racc
|
22
|
-
racc (1.7.
|
22
|
+
racc (1.7.3)
|
23
23
|
rack (3.0.8)
|
24
24
|
rack-test (2.1.0)
|
25
25
|
rack (>= 1.3)
|
26
26
|
rainbow (3.1.1)
|
27
|
-
rake (13.0
|
27
|
+
rake (13.1.0)
|
28
28
|
regexp_parser (2.8.2)
|
29
29
|
rexml (3.2.6)
|
30
30
|
rspec (3.12.0)
|
@@ -36,7 +36,17 @@ module OpenapiParameters
|
|
36
36
|
when 'array'
|
37
37
|
convert_array(value, schema)
|
38
38
|
else
|
39
|
-
|
39
|
+
if schema['properties']
|
40
|
+
convert_object(value, schema)
|
41
|
+
else
|
42
|
+
value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def convert_object(object, schema)
|
48
|
+
object.each_with_object({}) do |(key, value), hsh|
|
49
|
+
hsh[key] = convert(value, schema['properties']&.fetch(key, nil))
|
40
50
|
end
|
41
51
|
end
|
42
52
|
|
@@ -46,12 +56,6 @@ module OpenapiParameters
|
|
46
56
|
schema && schema['type']
|
47
57
|
end
|
48
58
|
|
49
|
-
def convert_object(object, schema)
|
50
|
-
object.each_with_object({}) do |(key, value), hsh|
|
51
|
-
hsh[key] = convert(value, schema['properties']&.fetch(key))
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
59
|
def convert_array(array, schema)
|
56
60
|
return array unless array.is_a?(Array)
|
57
61
|
|
@@ -16,7 +16,7 @@ module OpenapiParameters
|
|
16
16
|
parsed_query = Rack::Utils.parse_query(query_string)
|
17
17
|
parameters.each_with_object({}) do |parameter, result|
|
18
18
|
parameter = Parameter.new(parameter)
|
19
|
-
if parameter.style == 'deepObject'
|
19
|
+
if parameter.style == 'deepObject'
|
20
20
|
parsed_nested_query = Rack::Utils.parse_nested_query(query_string)
|
21
21
|
next unless parsed_nested_query.key?(parameter.name)
|
22
22
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openapi_parameters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Haller
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|