rspec-openapi 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rspec/openapi/schema_builder.rb +11 -5
- 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: 64afa135a6f5a64d96bf01dbf50457b98964a0875a21f0e85c159dc16cbd6a11
|
|
4
|
+
data.tar.gz: '048bab9ffc8d6c6876a3c2aeb03e7cf68ba992db9da6953d50dfef9106fe5acd'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9967fb54526fc7d743f4ba7d1de62c5a65b8a47ccc4350a55c575eef27d38110dfcc4ff2614fc02664d4eb622fb302422e1352cc2bbdb28e955989bc051609b7
|
|
7
|
+
data.tar.gz: b407e68dee10bf81a9b4ced14e8b767ce9099fd3ebedbecb67f43fd0f994fb06fb10868b422ba0fef9c6d4bbeaca2c06db5f58758f8ac09953c608949a6574ff
|
|
@@ -331,10 +331,9 @@ class << RSpec::OpenAPI::SchemaBuilder
|
|
|
331
331
|
alias normalize_content_disposition normalize_content_type
|
|
332
332
|
|
|
333
333
|
def build_array_items_schema(array, ctx)
|
|
334
|
-
return {} if array.empty?
|
|
335
|
-
|
|
336
334
|
schemas = array.map { |item| build_property(item, ctx) }
|
|
337
|
-
return schemas.first if schemas.size == 1
|
|
335
|
+
return schemas.first if schemas.size == 1
|
|
336
|
+
return merge_non_object_item_variations(schemas) unless array.all?(Hash)
|
|
338
337
|
|
|
339
338
|
merged = schemas.first.dup
|
|
340
339
|
merged[:properties] = merge_property_variations(schemas, allow_recursive_merge: false)
|
|
@@ -342,9 +341,16 @@ class << RSpec::OpenAPI::SchemaBuilder
|
|
|
342
341
|
merged
|
|
343
342
|
end
|
|
344
343
|
|
|
345
|
-
def
|
|
346
|
-
|
|
344
|
+
def merge_non_object_item_variations(schemas)
|
|
345
|
+
nullable_only = ->(schema) { schema.keys == [:nullable] }
|
|
346
|
+
typed = schemas.reject(&nullable_only)
|
|
347
|
+
|
|
348
|
+
merged = typed.size == 1 ? typed.first.dup : merge_multi(typed)
|
|
349
|
+
merged[:nullable] = true if schemas.any?(&nullable_only) && merged.is_a?(Hash)
|
|
350
|
+
merged
|
|
351
|
+
end
|
|
347
352
|
|
|
353
|
+
def build_merged_schema_from_variations(variations)
|
|
348
354
|
# Drop empty `{}` schemas (e.g. items of an empty array) — they carry no
|
|
349
355
|
# type info and would otherwise spuriously mark every property of their
|
|
350
356
|
# populated siblings as nullable via the missing-key nullable rule.
|
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.
|
|
4
|
+
version: 0.32.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Takashi Kokubun
|
|
@@ -97,7 +97,7 @@ licenses:
|
|
|
97
97
|
metadata:
|
|
98
98
|
homepage_uri: https://github.com/exoego/rspec-openapi
|
|
99
99
|
source_code_uri: https://github.com/exoego/rspec-openapi
|
|
100
|
-
changelog_uri: https://github.com/exoego/rspec-openapi/releases/tag/v0.
|
|
100
|
+
changelog_uri: https://github.com/exoego/rspec-openapi/releases/tag/v0.32.0
|
|
101
101
|
rubygems_mfa_required: 'true'
|
|
102
102
|
rdoc_options: []
|
|
103
103
|
require_paths:
|