vectordotdev / vrl

Vector Remap Language
Mozilla Public License 2.0
138 stars 69 forks source link

`del` does not compact objects when the requested path does not exist #1105

Open bruceg opened 4 weeks ago

bruceg commented 4 weeks ago

When using del with compact: true, the docs say:

After deletion, if compact is true and there is an empty object or array left, the empty object or array is also removed

However, if the path that is given does not exist, no compaction of the parents is done.

For example, given the VRL program del(.foo.bar, compact: true) and an input object of {"foo": {"bar":true}}, the result is an empty object. However, with an input object of {"foo": {}}, the result is unchanged, even though the implication is that "foo" would be compacted.