Skip to content

Commit

Permalink
Update schema_cleaner.rb
Browse files Browse the repository at this point in the history
undefined method `empty?' for nil:NilClass
  • Loading branch information
AlexeyMatskevich committed Jun 16, 2023
1 parent bf8ac1e commit d5cfe61
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rspec/openapi/schema_cleaner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Check warning

Code scanning / Rubocop

Avoid `foo&.empty?` in conditionals. Warning

Lint/SafeNavigationWithEmpty: Avoid calling empty? with the safe navigation operator in conditionals.

Check warning on line 50 in lib/rspec/openapi/schema_cleaner.rb

View check run for this annotation

Codecov / codecov/patch

lib/rspec/openapi/schema_cleaner.rb#L50

Added line #L50 was not covered by tests
end
end

Expand Down

0 comments on commit d5cfe61

Please sign in to comment.