ygot icon indicating copy to clipboard operation
ygot copied to clipboard

converison between generated go struct and proto

Open blnprasad opened this issue 5 years ago • 5 comments

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?

blnprasad avatar Jul 17 '19 08:07 blnprasad

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.

robshakir avatar Jul 26 '19 20:07 robshakir

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

blnprasad avatar Jul 29 '19 10:07 blnprasad

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.

robshakir avatar Jul 31 '19 22:07 robshakir

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?

seiferteric avatar Apr 29 '20 19:04 seiferteric

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

mkieweg avatar Apr 22 '21 12:04 mkieweg