reva
reva copied to clipboard
protobuf should be un-/marshaled using protojson, not encoding/json
OMG ... protobuf generated code has a json tag that uses snake_case AND a protobuf tag that uses camel case:
// REQUIRED.
// The list of app providers which can open this mime type
AppProviders []*ProviderInfo `protobuf:"bytes,4,rep,name=app_providers,json=appProviders,proto3" json:"app_providers,omitempty"`
But the json tag and encoding/json should not be used:
Generation of the
json
tags was a historical mistake. If we could go back in time, we would not have generated it. It gives the illusion that protobuf messages work correctly withencoding/json
, but they don't.
Unfortunately, we are using encoding/json
all over the place. google.golang.org/protobuf/encoding/protojson should be used.
AFAICT that would change all the generated json clients rely on ... 😞