I would like to get a proto Descriptor from a string that defines the message protocol. For example I have:
public final static String schema = ""
+ "message Person {\n"
+ " required string id = 1;\n"
+ " required string name = 2;\n"
+ "}";
@Test
public void dynamicProto() throws IOException {
DescriptorProtos.DescriptorProto descriptor = DescriptorProtos.DescriptorProto.parseFrom(schema.getBytes());
boolean test = true;
//do stuff
}
I get the following exception: com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type.
Ultimately I want to be able to define a schema and accept the actual proto message at runtime as opposed to compile time for some mock service type stuff.