-
-
Notifications
You must be signed in to change notification settings - Fork 726
Open
Description
I have created a YAML "!eval" tag to evaluate embedded yq expressions.
yq '. ref $root | (.. | select(tag == "!eval")) |= (. tag = "" | . as $expr | $root | eval($expr))' t.yaml
x: 1
y: 2
z: !eval .x + .y
x: 1
y: 2
z: 3
If the expression consists of undefined values sometimes the value is unchanged.
x: 1
y: 2
z: !eval .a + .b
x: 1
y: 2
z: .a + .b
In other cases the value is null, but also results in new keys being created for the undefined values.
x: 1
y: 2
z: !eval .a * .b
x: 1
y: 2
z: null
a: null
b: null
I am guessing this has something to do with the expression being evaluated to null versus something else.
I'm not sure if this is a bug, but it seems wrong that it would create new keys.