thanks ill take a look also on that On Wednesday, October 4, 2023 at 5:01:54 PM UTC+3 Gary Peck wrote:
> It's not Java/Scala, but another option is buf's proto parser written in > Go: https://github.com/bufbuild/protocompile. > > Gary > > > On Wednesday, October 4, 2023 at 4:04:56 AM UTC-7 Ran Volkovich wrote: > >> Hi, >> thanks for the the answer. >> this is great if i wont find any scala/java lib that does this i might >> use it thanks >> >> On Wednesday, October 4, 2023 at 1:42:06 PM UTC+3 Marc Gravell wrote: >> >>> If .NET is an option, protobuf-net has this (in the >>> protobuf-net.Reflection package): >>> >>> var schema = """ >>> >>> syntax = "proto3"; >>> >>> package helloworld; >>> >>> // My cool new message >>> message MyMessage { >>> string some_string = 1; >>> repeated int64 some_numbers = 2; >>> } >>> """; >>> var set = new FileDescriptorSet(); >>> set.Add("some.proto", source: new StringReader(schema)); >>> set.Process(); >>> >>> foreach (var file in set.Files) >>> { >>> Console.WriteLine($"in {file.Name}"); >>> foreach (var msg in file.MessageTypes) >>> { >>> Console.WriteLine(msg.Name); >>> foreach (var field in msg.Fields) >>> { >>> Console.WriteLine($"> {field.Name}"); >>> } >>> } >>> Console.WriteLine(); >>> } >>> >>> >>> This is entirely managed code (i.e. no "shell to protoc"). The API is >>> basically identical to the Google one - the idea is that the type system is >>> binary compatible (i.e. you can serialize it as protobuf and you'd get the >>> same thing that protoc would give, in binary mode) >>> >>> On Wed, 4 Oct 2023 at 10:02, 'Ran Volkovich' via Protocol Buffers < >>> [email protected]> wrote: >>> >>>> Hi, >>>> There is a way to transform .proto file like >>>> syntax = "proto3"; >>>> >>>> package helloworld; >>>> >>>> // My cool new message. >>>> message MyMessage { >>>> string some_string = 1; >>>> repeated int64 some_numbers = 2; >>>> } >>>> to FileDescriptorProto class from com.google.protobuf jar (or any other >>>> proto lib that can represent the proto schema) >>>> without to use protoc to generate descriptor before? >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Protocol Buffers" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/protobuf/ad559f9f-8112-4bbe-b0b8-43f4b64d6d60n%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/protobuf/ad559f9f-8112-4bbe-b0b8-43f4b64d6d60n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> >>> >>> -- >>> Regards, >>> >>> Marc >>> >> -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/16e41011-24ab-4143-9b11-acce01d6d0d2n%40googlegroups.com.
