-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coerce an empty string to nil in case of the bool type #2049
Conversation
7d83410
to
7404f1e
Compare
@@ -46,7 +46,7 @@ def call(val) | |||
|
|||
attr_reader :type | |||
|
|||
# This method maintaine logic which was defined by Virtus. For example, | |||
# This method maintain logic which was defined by Virtus. For example, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we fixing this, let's actually fix it with "This method maintains" :)
@@ -55,6 +55,12 @@ def reject?(val) | |||
(val.is_a?(String) && type == Hash) || | |||
(val.is_a?(Hash) && type == String) | |||
end | |||
|
|||
# Dry-Types treats an empty string as invalid. However, Grape community wants to have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should explain why and link to the issue. How about: "However, Grape considers an empty string as absence of value and coerces it into nil
."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to merge after cosmetic fixes in comments.
6cd7fce
to
9f49439
Compare
9f49439
to
fe172fe
Compare
Satisfies a pending test in #2045