www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - protobuf-d

reply Robert Aron <aronrobert293 gmail.com> writes:
Hello!

I am currently working on "D Language Client Libraries for Google 
APIs" project[0][1].
The first step was to familiarize myself with protobuf and to 
generate client library for cloud/vision using python plugin with 
protoc.
Today I generated the same library with protobuf-d[2]. When I 
tried to translate this example[3] from python to D, I noticed 
that some pieces of code are missing from the D generated 
library, for example the ImageAnnotatorClient class(or struct) (I 
could not found it anywhere in the generated code).

Here is the command that I used to generate the client library:

protoc path/to/cloud/vision/proto/files
--proto_path=path/to/common/api/protos --proto-path=.
--plugin=path/to/protobuf-d --d_opt=message-as-struct
--d_out=path/to/output/files

Is that ok? Does it work as it should?
Also I read here[4] that the C++ generator defines some default 
methods.
Wasn't the proto-gen-d supposed to do the same?

Thanks!

[0] https://github.com/dlang/projects/issues/66
[1] 
https://forum.dlang.org/post/eaefvlbgikujonfjjzqi forum.dlang.org
[2] https://github.com/dcarp/protobuf-d
[3] 
https://gapic-generator-python.readthedocs.io/en/stable/getting-started/docker.html#verifying-the-library
[4] 
https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#message
Sep 29 2020
parent Denis Feklushkin <feklushkin.denis gmail.com> writes:
On Tuesday, 29 September 2020 at 15:38:43 UTC, Robert Aron wrote:
 Hello!

 I am currently working on "D Language Client Libraries for 
 Google APIs" project[0][1].
 The first step was to familiarize myself with protobuf and to 
 generate client library for cloud/vision using python plugin 
 with protoc.
 Today I generated the same library with protobuf-d[2]. When I 
 tried to translate this example[3] from python to D, I noticed 
 that some pieces of code are missing from the D generated 
 library, for example the ImageAnnotatorClient class(or struct) 
 (I could not found it anywhere in the generated code).

 Here is the command that I used to generate the client library:

 protoc path/to/cloud/vision/proto/files
 --proto_path=path/to/common/api/protos --proto-path=.
 --plugin=path/to/protobuf-d --d_opt=message-as-struct
 --d_out=path/to/output/files

 Is that ok? Does it work as it should?
 Also I read here[4] that the C++ generator defines some default 
 methods.
ImageAnnotatorClient isn't described in any of *.proto file in https://github.com/googleapis/googleapis repository. (I found only ImageAnnotator) So, maybe here is messed up proto3 and gRPC or something like it?
Sep 29 2020