How to get my prost_types::DescriptorProto for my message from .proto file?
I have written a rust program to invoke google bigquery storage write API via grpc w/ protobuf by gcloud-sdk "google.cloud.bigquery.storage.v1".
https://github.com/abdolence/gcloud-sdk-rs
2023-02-17T08:16:04.492220Z DEBUG gcloud_sdk::middleware: OK: /google.cloud.bigquery.storage.v1.BigQueryWrite/AppendRows took 262ms (incl. token gen: 0ms) Error: Status { code: InvalidArgument, message: "Invalid proto schema: BqMessage.proto: my.proto: \"my.proto\" is not a valid identifier. Entity: projects/steam-sequencer-xxxxxx/datasets/my_dataset/tables/test_table/streams/_default", source: None }
There is an argument puzzling me particularly!
pub struct ProtoSchema { pub proto_descriptor: Option<DescriptorProto>, }
ProtoSchema describes the schema of the serialized protocol buffer data rows.
It's a "prost_types::DescriptorProto" indeed.
In many languages, it is generated/supported by the languages/package out-of-the-box.
Because I am a newbie for Rust, Prost & Grpc, does any one know how to get the DescriptorProto struct from my proto file via prost / tonic crate ?
Thank you very much!
let x = DescriptorProto {
name: Some(String::from("my.proto")),
field: vec![],
extension: vec![],
nested_type: vec![],
enum_type: vec![],
extension_range: vec![],
oneof_decl: vec![],
options: None,
reserved_range: vec![],
reserved_name: vec![],
};
let proto_schema = ProtoSchema {
proto_descriptor: Some(x),
};
let proto_data = ProtoData {
writer_schema: Some(proto_schema),
rows: Some(proto_rows),
};