Re: [protobuf] Re: How to: get the parent message

2022-11-29 Thread Josh Humphries
No official runtimes provide a way to do this. Messages do not have backlinks to containers if they are nested inside another message. To do what you are trying to do would require a recursive traversal that starts at the top (a) and then accumulates the names into a path with each recursive

Re: [protobuf] Re: How to: get the parent message

2022-11-22 Thread Fred Eisele
Thanks for the answers. I am using Kotlin. I will modify my sequence to yield on a pair. * the current path * the current object It should be a minor change. Currently, the yield is on the current object only. On Tuesday, November 22, 2022 at 11:16:29 AM UTC-6 thes...@gmail.com wrote: > Hi

Re: [protobuf] Re: How to: get the parent message

2022-11-22 Thread Nadav Samet
Hi Fred, you haven't mentioned a specific language you use, but in all the standard implementations I am familiar with (Java, Python, C++) an instance of a message doesn't hold a reference to its container. The opposite is true, you can find all the fields if you start working from the root. To

[protobuf] Re: How to: get the parent message

2022-11-22 Thread Fred Eisele
Given a message (b of type B), nested in another (a of type A); how does one get ‘a’? I was hoping for something like ‘b.getParent()’. message B { optional string name = 1; repeated B b = 2; } message A { optional string name = 1; repeated B b = 1; } Here is an example instance of an ‘a’ with