From 66130ffaf142e0db389a21c6bbf89ed96b6f31a2 Mon Sep 17 00:00:00 2001 From: Jay Zhu Date: Tue, 9 May 2023 07:15:02 -0600 Subject: [PATCH] fix(ytypes): fix node cache condition for `unmarshalGeneric` --- ytypes/node_cache.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ytypes/node_cache.go b/ytypes/node_cache.go index f1af617a..f7b12aa8 100644 --- a/ytypes/node_cache.go +++ b/ytypes/node_cache.go @@ -123,7 +123,8 @@ func (c *NodeCache) set(path *gpb.Path, val interface{}, opts ...SetNodeOpt) (se } // Set value in the config tree. - if (*schema).Parent != nil && (*schema).Parent.IsContainer() { + // Condition: not a node or the parent is a container. + if val.(*gpb.TypedValue).GetJsonIetfVal() == nil || ((*schema).Parent != nil && (*schema).Parent.IsContainer()) { var encoding Encoding var options []UnmarshalOpt if hasSetNodePreferShadowPath(opts) {