std.mergePatch should create resulting object fields at Normal visibility, not Unhide #255
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR changes the default visibility of fields in objects created by
std.mergePatch
: previously they were atUnhide
visibility, equivalent to the:::
operator, but as of this PR they are now atNormal
standard visibility.Concretely, previously
would return
{a: 1}
but after this patch it returns{a:: 1)
, i.e. it preserves the hidden field.It turns out that v0.20.0 of google/jsonnet and google/go-jsonnet also differ in their behavior here. That, in turn, is due to a behavior difference in the default visibility of fields in object comprehension results: jsonnet marks object comprehension fields as forced-visible, while go-jsonnet marks them as inherited visibility; see google/jsonnet#1111.
jsonnet accepted google/jsonnet#1140 to match go-jsonnet's behavior.
Note that sjsonnet already matches go-jsonnet's behavior for object comprehensions: we only have a difference in
std.mergePatch
because our current implementation explicitly hardcodes Unhide visibility.This PR changes that mergePatch-specific behavior to match the current go-jsonnet (and future jsonnet) behavior.