tafia / quick-protobuf

A rust implementation of protobuf parser
MIT License
452 stars 87 forks source link

pb-rs: Does it support reserved? #77

Closed AndreMouche closed 6 years ago

AndreMouche commented 7 years ago

Hi, I tried use tool pb-rs to generate rust code for message with reserved field, but meet the following phenomenon:

version

pb-rs 0.2.0

input1

cat test.proto                                                                                                                                              
syntax = "proto3";
package test;

import "gogoproto/gogo.proto";

option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.unmarshaler_all) = true;

message Sample {
   reserved 4;
   uint64 age =1;
   bytes name =2;
}

input2

cat test2.proto                                                                                                                                              
syntax = "proto3";
package test;

import "gogoproto/gogo.proto";

option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.unmarshaler_all) = true;

message Sample {
   uint64 age =1;
   bytes name =2;
}

input1 output an empty file while input2 output what I expected. It seems reserved coud not be identified?

Is there anything wrong?

Also, I meet the following error in my test:

  1. Param --include: It seems we can not include more than one directory ? (caused in -I, --include <INCLUDE_PATH> Path to search for imported protobufs
  2. Param --output seems not work (-o, --output <OUTPUT> Generated file name, defaults to INPUT with 'rs' extension)

Wish for your help, Thank you.

tafia commented 7 years ago

Thanks for opening the issue.

It seems reserved coud not be identified?

Is there anything wrong?

It is supposed to be supported. I'll have a look.

For the parameters, I'll also have a look but I will also ping @koivunej

tafia commented 7 years ago

I have just done a PR to fix reserved fields (#87). @AndreMouche could you please validate it before I merge it.