openconfig / ygot

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

converison between generated go struct and proto #296

Open blnprasad opened 5 years ago

blnprasad commented 5 years ago

I've generated go structs which i'm populating from json. After validation, i want to store/share in protobuf serialized format. I'm not finding proper way for conversion between generated go structs and protobuf. Is there any workaround?

robshakir commented 5 years ago

We started the work to convert between the generated Go structs and Protobufs, which is also described in this document. Currently, there's some outstanding work to be completed here. PRs to help implement this design, or improve upon it, are very welcome.

blnprasad commented 5 years ago

Thank you. Also i'm planning to get difference between two go structs in following way for given configuration section But i see it increasingly difficult to access value using path string(.RelayAgent.Dhcp.Interface["xyz"]). Any suggestions? https://github.com/d4l3k/messagediff

robshakir commented 5 years ago

To diff two generated structs you can use ygot.Diff. It outputs the diff between two Go structs that were generated by ygot using a series of gNMI Notification messages to describe the difference.

seiferteric commented 4 years ago

We started the work to convert between the generated Go structs and Protobufs, which is also described in this document. Currently, there's some outstanding work to be completed here. PRs to help implement this design, or improve upon it, are very welcome.

I get access denied when trying to access that document, can it be made public?

mkieweg commented 3 years ago

We started the work to convert between the generated Go structs and Protobufs, which is also described in this document. Currently, there's some outstanding work to be completed here. PRs to help implement this design, or improve upon it, are very welcome.

I get access denied when trying to access that document, can it be made public?

+1 to this