openconfig / ygot

A YANG-centric Go toolkit - Go/Protobuf Code Generation; Validation; Marshaling/Unmarshaling
Apache License 2.0
286 stars 107 forks source link

Dupliacte map key is not reported as an error during Map unmarshall issue #503

Open Victorwhatsup opened 3 years ago

Victorwhatsup commented 3 years ago

list v4mg{ key "priority"; leaf priority { type uint16; } }

Say. we have above yang, and convert it to ygot golang struct When I try to unmarshll below json ,which has dupliacte map key, to golang, it doenst report an error, and it only result in one map entry with key "priority =1"

"v4mg" : [ { "priority" : 1

    },
    {
        "priority" : 1

    }
]
Victorwhatsup commented 3 years ago

Hi, any update on the fix @wenovus ?

wenovus commented 3 years ago

Sorry I don't quite recall what I intended so I'll restart.

I can reproduce this issue, where duplicated list entries in the JSON just overwrite previous ones. I'm not sure if there is a rule dictating what should happen here. @robshakir do you know?