exprotobuf
exprotobuf copied to clipboard
Incorrect encoding
I am have this schema
message Promo {
string image = 1;
string adUrl = 2;
bool isAd = 3;
}
Used this data
promos=[Promo{image=https://djloboapp.com/main_images/djlobopromo_Android.jpg, isAd=false}, Promo{image=https://djloboapp.com/main_images/followDJLobo2_Android.jpg, adUrl=http://bit.ly/djloboinstagram, isAd=true}, Promo{image=https://djloboapp.com/main_images/djlobobooking_Android.jpg, isAd=false}]
Encoding this using exprotobuf produces
"=
9https://djloboapp.com/main_images/djlobopromo_Android.jpg"^
;https://djloboapp.com/main_images/followDJLobo2_Android.jpghttp://bit.ly/djloboinstagram"?
;https://djloboapp.com/main_images/djlobobooking_Android.jpg%
Any other implementation (I used google's implementation in Python & Golang) gives the following
";
9https://djloboapp.com/main_images/djlobopromo_Android.jpg"^
;https://djloboapp.com/main_images/followDJLobo2_Android.jpghttp://bit.ly/djloboinstagram"=
;https://djloboapp.com/main_images/djlobobooking_Android.jpg%
What is going wrong because of this:
I had no issues because of this until I decided to rewrite one part of the API in Go. The client was using Wire to decode response. Since Wire uses Boolean
instead of boolean
the response from any other library other than exprotobuf was making it null instead of false. Even though I wish other implementations follow what exprotobuf does, in current state, it does not follow the specification
I'm a bit unclear what exprotobuf should be doing here - do you have a reference to the spec for this, and perhaps a bit more detail pointing out what is different and what you think exprotobuf should be doing? It may be the case that this is something which needs to be addressed in gpb, but I'll definitely take a look at this if I know a bit more about what's wrong.