-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[confmap][fix] Correctly differentiate between nil and empty slices in ToStringMap
#11755
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11755 +/- ##
==========================================
- Coverage 91.53% 91.52% -0.02%
==========================================
Files 443 443
Lines 23766 23770 +4
==========================================
+ Hits 21754 21755 +1
- Misses 1638 1640 +2
- Partials 374 375 +1 ☔ View full report in Codecov by Sentry. |
if m == nil { | ||
return newSlice | ||
} |
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.
@mx-psi This block is currently not covered by tests because we're not decoding nil values in this PR (that will happen in #11734). We could (1) remove this if block here and add it in the following PR; (2) leave it in here but merge with missing code coverage; (3) add a unit test for this function directly. Let me know what you think.
Let's wait to discuss this with @songy23 |
The description is confusing to me
What does this tell me? What I would rather see is something like this:
|
@yurishkuro Thanks for the feedback! I updated the description. One thing to note is that the discrepancy is not within the hook but rather |
Description
zeroSliceHookFunc
which treats empty slices provided in the config as empty slices rather than nilconfmap.ToStringMap
, empty slices were getting rendered as nil which is different from the decoder hook as described above.confmap.ToStringMap
by adding a check in the sanitizer function that returns an empty slice when one is provided.confmap
to enable optional configs.Link to tracking issue
Fixes #11749
Testing