[472] - Fix for Accept nullable parameter#498
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #498 +/- ##
==========================================
+ Coverage 90.08% 90.11% +0.03%
==========================================
Files 76 76
Lines 1584 1589 +5
==========================================
+ Hits 1427 1432 +5
Misses 157 157
☔ View full report in Codecov by Sentry. |
|
@bastelfreak - Can you review this, Please. |
|
@jahir-husain can you please rebase against our latest master branch and squash the commits down? |
| def self.data_valid_for_type?(data, type) | ||
| def self.data_valid_for_type?(data, type, nullable: false) | ||
| valid_classes = TYPE_CLASS_MAPPINGS.fetch(type) { return true } | ||
| valid_classes = [valid_classes, NilClass] if nullable |
There was a problem hiding this comment.
in case when type is boolean, you need to flatten the valid_classes
type = "boolean"
valid_classes = TYPE_CLASS_MAPPINGS.fetch(type) # => [TrueClass, FalseClass]
valid_classes = [valid_classes, NilClass] if nullable # => [[TrueClass, FalseClass], NilClass]
Array(valid_classes).any? { |c| data.is_a?(c) } # => #<TypeError: class or module required>
|
@jahir-husain can you please take a look at the comment and rebase against our latest master (so we get rid of the merge commits). |
|
@jahir-husain please rebase instead of doing a merge. |
|
any update? |
|
@kntmrkm this PR needs a rebase. If you want you can checkout the code locally, rebase it against our Head and then submit a new PR. |
|
|
Fix for issue #472