mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-13 03:42:35 -06:00
301efc6997
This commit extends the go and wasm implementations of object.get to allow a key to also be an array. When passed an array, each element in the array will be used as a key in turn. This allows values at deeply nested paths to be extracted from objects. It also supports getting indexes of nested arrays. The functionality was originally inspired by Ruby's Hash.dig function: https://ruby-doc.org/core-2.3.0_preview1/Hash.html#method-i-dig however we opted to include the behavior in object.get instead after being uncertain 'dig' was a commonly understood name. Signed-off-by: Charlie Egan <charlieegan3@users.noreply.github.com>