diff --git a/lib/rspec/openapi/schema_cleaner.rb b/lib/rspec/openapi/schema_cleaner.rb index 89e287ed..28171bc2 100644 --- a/lib/rspec/openapi/schema_cleaner.rb +++ b/lib/rspec/openapi/schema_cleaner.rb @@ -47,7 +47,7 @@ def cleanup_empty_required_array!(base) paths_to_objects.each do |path| parent = base.dig(*path.take(path.length - 1)) # "required" array must not be present if empty - parent.delete('required') if parent['required'].empty? + parent.delete('required') if parent['required']&.empty? end end