Skip to content
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

Fix value merging for empty lists #2995

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Fix value merging for empty lists #2995

wants to merge 4 commits into from

Conversation

blampe
Copy link
Contributor

@blampe blampe commented May 3, 2024

This fixes our behavior to match upstream's when merging empty lists. We now produce an empty list instead of a no-op.

The bug was due to this logic which initialized a slice as nil. This was then passed to mergo.Merge which ignores zero values by default, hence why the original value was not overridden.

This PR changes our allowNullValues logic to use upstream's merge behavior more directly since the intention behind that flag is to match upstream as closely as possible.

Importantly, this doesn't fix #2034 because we're still unmarshaling inputs with SkipNulls: true. In practice allowNullValues behaves more like allowEmptyValues because our unmarshaling strips away all of the meaningful nil values. That fix will be in another PR.

Fixes #2731.
Refs #2034.
Refs #2963.

Copy link

github-actions bot commented May 3, 2024

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link

codecov bot commented May 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 35.82%. Comparing base (04fb15c) to head (12ffc99).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2995      +/-   ##
==========================================
- Coverage   35.97%   35.82%   -0.15%     
==========================================
  Files          70       70              
  Lines        9156     9135      -21     
==========================================
- Hits         3294     3273      -21     
  Misses       5530     5530              
  Partials      332      332              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty array value still ignored in Helm Chart Unable to delete a Chart default key
1 participant