openconfig / ygot

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

"default value not supported for wrapper union values" #982

Closed Sneh-Prabha closed 1 month ago

Sneh-Prabha commented 1 month ago

Hi, I am trying to generate gostruct file using ygot/generator/generator.go and I have a union leaf type having a default value. Getting this error while code generation "default value not supported for wrapper union values, please generate using simplified union leaves". leaf ageing-time { type xstp_ageing_time_t; units "seconds"; default 300; description "aging-out time for MAC address."; } typedef xstp_ageing_time_t { type union { type uint32 { range "10..1000000"; } type xstp_ageing_disable { } } description "definition "; } typedef xstp_ageing_disable { type enumeration { enum 0 { value 0; description "Disable Ageing Time"; } } description "definition"; }

Let me know if it is known issue or expected behaviour.

robshakir commented 1 month ago

This is expected, please use the flag generate_simple_unions as suggested by the error text.