@@ -102,6 +102,85 @@ func TestUnmarshalSetRequest(t *testing.T) {
102102 },
103103 },
104104 },
105+ }, {
106+ desc : "updates to a struct containing a non-empty list" ,
107+ inSchema : & Schema {
108+ Root : & ContainerStruct1 {
109+ StructKeyList : map [string ]* ListElemStruct1 {
110+ "forty-two" : {
111+ Key1 : ygot .String ("forty-two" ),
112+ Outer : & OuterContainerType1 {
113+ Inner : & InnerContainerType1 {
114+ Int32LeafName : ygot .Int32 (43 ),
115+ Int32LeafListName : []int32 {100 },
116+ StringLeafName : ygot .String ("bear" ),
117+ },
118+ },
119+ },
120+ "forty-three" : {
121+ Key1 : ygot .String ("forty-three" ),
122+ Outer : & OuterContainerType1 {
123+ Inner : & InnerContainerType1 {
124+ Int32LeafName : ygot .Int32 (43 ),
125+ Int32LeafListName : []int32 {100 },
126+ StringLeafName : ygot .String ("bear" ),
127+ },
128+ },
129+ },
130+ },
131+ },
132+ SchemaTree : map [string ]* yang.Entry {
133+ "ContainerStruct1" : containerWithStringKey (),
134+ },
135+ },
136+ inReq : & gpb.SetRequest {
137+ Prefix : & gpb.Path {},
138+ Update : []* gpb.Update {{
139+ Path : mustPath ("/" ),
140+ Val : & gpb.TypedValue {Value : & gpb.TypedValue_JsonIetfVal {
141+ JsonIetfVal : []byte (`
142+ {
143+ "config": {
144+ "simple-key-list": [
145+ {
146+ "key1": "forty-two",
147+ "outer": {
148+ "inner": {
149+ "int32-leaf-list": [42]
150+ }
151+ }
152+ }
153+ ]
154+ }
155+ }
156+ ` ),
157+ }},
158+ }},
159+ },
160+ want : & ContainerStruct1 {
161+ StructKeyList : map [string ]* ListElemStruct1 {
162+ "forty-two" : {
163+ Key1 : ygot .String ("forty-two" ),
164+ Outer : & OuterContainerType1 {
165+ Inner : & InnerContainerType1 {
166+ Int32LeafName : ygot .Int32 (43 ),
167+ Int32LeafListName : []int32 {42 },
168+ StringLeafName : ygot .String ("bear" ),
169+ },
170+ },
171+ },
172+ "forty-three" : {
173+ Key1 : ygot .String ("forty-three" ),
174+ Outer : & OuterContainerType1 {
175+ Inner : & InnerContainerType1 {
176+ Int32LeafName : ygot .Int32 (43 ),
177+ Int32LeafListName : []int32 {100 },
178+ StringLeafName : ygot .String ("bear" ),
179+ },
180+ },
181+ },
182+ },
183+ },
105184 }, {
106185 desc : "updates of invalid paths to non-empty struct with IgnoreExtraFields" ,
107186 inSchema : & Schema {
0 commit comments