bitwalker / bitwalker/exprotobuf

Incorrect encoding

Open
#77 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Elixir
Stars
482
Forks
68
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the Promo schema encoding with exprotobuf and compare it with the Google Python and Go implementations shown in the report. Check the Protocol Buffers specification for field tags and boolean encoding, then verify that the corrected output decodes consistently in Wire, including false values.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir, go, python
Domain
backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.