-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a bug in hidden field handling in std.mergePatch (#250)
This PR fixes a bug related to handling of hidden fields in `std.mergePatch`: In both google/jsonnet and google/go-jsonnet, hidden fields are ineligible to participate in field merges: - `std.mergePatch({a: 1}, {a :: 2}` - should return `{a: 1}` (ignoring the hidden patch field) - sjsonnet returns `{a: 2}` - `std.mergePatch({a: {a: 1}}, {a:: {b: 1}}` - should return `{a: {a: 1}}` - sjsonnet returns `{a: {a: 1, b: 1}}` - `std.mergePatch({a:: {a: 1}}, {a: {b: 1}}` (symmetrical to previous case, but swaps hidden between target and patch) - should return `{a: {b: 1}}` - sjsonnet returns `{a: {a: 1, b: 1}}` The problem is that the current code iterates over the union of visible fields, but never re-checks the specific visibility in target and patch during per-field merges. This PR fixes that bug and significantly expands unit test coverage for `std.mergePatch`.
- Loading branch information
Showing
2 changed files
with
78 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters