-
Notifications
You must be signed in to change notification settings - Fork 13
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
add coerce_empty_to_nil
config for string conversion
#65
add coerce_empty_to_nil
config for string conversion
#65
Conversation
Codecov Report
@@ Coverage Diff @@
## master #65 +/- ##
==========================================
+ Coverage 99.22% 99.26% +0.04%
==========================================
Files 6 6
Lines 386 409 +23
==========================================
+ Hits 383 406 +23
Misses 3 3
Help us with your feedback. Take ten seconds to tell us how you rate us. |
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.
Thank you for the quick turnaround and your contribution @leifg! This seems pretty great to me, and I've had a chance to test this locally (as well as on CI - thanks for submitting the PR to resolve the issues with ruby 3+).
What are your thoughts on also adding a global configuration parameter, similar to TypeCoerce::Configuration.raise_coercion_error
? No need to do this if you don't think it's necessary (for example, I'm not sure if it's relevant in your use-case of request parsing).
As an aside, I'll probably publish a new release of the gem after we merge this in. Hopefully you'll have a chance to test this soon!
coerce_empty_to_nil
config for string conversion
For me personally I don't see a use case. In addition: making something like a global flag could cause unwanted errors because you would get instances of TypeError where an empty string is fine. |
Sounds good, just wanted to check in. Thanks again for your contribution, much appreciated! |
Of course! Always happy to help out. |
…` option) (#396) * Updates `sorbet-coerce` with new `coerce_empty_to_nil` option See: chanzuckerberg/sorbet-coerce#65 and release notes: https://github.com/chanzuckerberg/sorbet-coerce/releases/tag/v0.6.0 * renames folder to be a simple constraint
After clarifying in #58 seems to be a good config flag for coercing empty strings into nil.
Closes #58.