google / google/jsonnet

shorthand for deep field overrides

Open
#227 8 comments 7 reactions 0 assignees View on GitHub
enhancement
Dominant language
Jsonnet
Stars
7.6k
Forks
475
PR merge metrics
No merged PRs in 30d

Description

``` jsonnet

local foo = {
a: { b: { c: { d: 1234 } } },
e: 1
};

foo + { a.b.c.d: 999 }
```

It would be really cool if the above (or something along those lines) worked and evaluated to:

``` jsonnet
{
a: { b: { c: { d: 999 } } },
e: 1
}
```

To achieve the same in today's jsonnet you would have to write:

``` jsonnet
local foo = {
a: { b: { c: { d: 1234 } } },
e: 1
};

foo + { a+: { b+: { c+: { d: 9999} }
```

I don't know how difficult and/or sane this would be to implement, but there is a similar construct in Nix that is quite useful :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.