rspec-openapi 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/rspec/openapi/result_recorder.rb +1 -0
- data/lib/rspec/openapi/schema_cleaner.rb +12 -0
- data/lib/rspec/openapi/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: 86927b142ea56ae6b4c2c4f70c1cf8d21159b85f614369d4af15c91489e56647
|
4
|
+
data.tar.gz: 3711fffd6052537911f4bfaafdb2d22fba78a1649f71c97f16325d79ccc3d427
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a54a6a78f142fc39b7a4ad5a5afd92e2486ba320e414e0782f0eb2c386535588e6126c851d868b265807a29844706547a6757fb1d45a2eb1cda820923fa7c15
|
7
|
+
data.tar.gz: b53892f024ecb7733fb99e83ab1c299d3ae0b36465a2ca806d1234896a90fd45bf47df335bc14977004aa8c113c272daadf029b4c0c7ad46773be1ad5e2dec0e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## v0.8.1
|
2
|
+
- bugfix: Empty `required` array should not be present.
|
3
|
+
[#111](https://github.com/exoego/rspec-openapi/pull/111)
|
4
|
+
|
1
5
|
## v0.8.0
|
2
6
|
- Set `required` in request body and response body
|
3
7
|
[#95](https://github.com/exoego/rspec-openapi/pull/95), [#98](https://github.com/exoego/rspec-openapi/pull/98)
|
@@ -26,6 +26,7 @@ class RSpec::OpenAPI::ResultRecorder
|
|
26
26
|
end
|
27
27
|
RSpec::OpenAPI::SchemaCleaner.cleanup!(spec, new_from_zero)
|
28
28
|
RSpec::OpenAPI::ComponentsUpdater.update!(spec, new_from_zero)
|
29
|
+
RSpec::OpenAPI::SchemaCleaner.cleanup_empty_required_array!(spec)
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
@@ -39,6 +39,18 @@ class << RSpec::OpenAPI::SchemaCleaner = Object.new
|
|
39
39
|
base
|
40
40
|
end
|
41
41
|
|
42
|
+
def cleanup_empty_required_array!(base)
|
43
|
+
paths_to_objects = [
|
44
|
+
*RSpec::OpenAPI::HashHelper.matched_paths_deeply_nested(base, 'components.schemas', 'properties'),
|
45
|
+
*RSpec::OpenAPI::HashHelper.matched_paths_deeply_nested(base, 'paths', 'properties'),
|
46
|
+
]
|
47
|
+
paths_to_objects.each do |path|
|
48
|
+
parent = base.dig(*path.take(path.length - 1))
|
49
|
+
# "required" array must not be present if empty
|
50
|
+
parent.delete('required') if parent['required'].empty?
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
42
54
|
private
|
43
55
|
|
44
56
|
def cleanup_array!(base, spec, selector, fields_for_identity = [])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-openapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-04-
|
12
|
+
date: 2023-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|