Protobuf api/tool to generate .proto

59 views
Skip to first unread message

Ran Volkovich

unread,
Oct 3, 2023, 2:14:04 AM10/3/23
to Protocol Buffers
Hi,
 i have a need to generate dynamically .proto files descriptor  
and i didnt find any api/tools to do so 
the only thing that near to that was with 
use the jar: "com.google.protobuf" % "protobuf-java" % "3.18.1"
val fileDescriptorProto = FileDescriptorProto.newBuilder()
.setName("a")
.setSyntax("proto3")
.setPackage("b")
.addMessageType(DescriptorProto.newBuilder()
.setName("c")
.addField(FieldDescriptorProto.newBuilder()
.setName("d")
.setType(FieldDescriptorProto.Type.TYPE_STRING)
.build())
.build())
.build()

the output look like this:
name: "a"

package: "b"

message_type {

  name: "c"

  field {

    name: "d"

    type: TYPE_STRING

  }

}

syntax: "proto3"

when i want to get this:
syntax = "proto3";
message c {
  repeated google.protobuf.StringValue d = 1;
 }

anyone have idea where to look or what can i do? 

thanks 

Derek Perez

unread,
Oct 3, 2023, 2:58:10 AM10/3/23
to Ran Volkovich, Protocol Buffers
I wrote a small Java library that can do this:

--
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 protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/8107cc4c-a790-4868-9e6f-89a754036b63n%40googlegroups.com.

Ran Volkovich

unread,
Oct 3, 2023, 3:18:14 AM10/3/23
to Protocol Buffers
Hi thanks for your response i will test it :)

Ran Volkovich

unread,
Oct 3, 2023, 8:33:26 AM10/3/23
to Protocol Buffers
Hey its worked thanks :)
Reply all
Reply to author
Forward
0 new messages