ktr0731 / evans

Evans: more expressive universal gRPC client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support custom JSON simplification

yonik opened this issue · comments

Feature request:
The support of well-known-types like google.protobuf.Struct works great! Unfortunately google's Struct has many missing types. It would be great if there was a way to provide such simplifications to user defined types.

commented

Hi, thanks for proposing a new feature request.
Does that mean we need a mechanism to implicitly read user-defined types?

I think what's needed are directives controlling how JSON serialization / deserialization works on a per-type / per-field basis. It looks like protobuf3 custom options might be the right tool to specify these custom serialization rules:
https://developers.google.com/protocol-buffers/docs/proto3#options
One example of this idea would be an option that one could attach to a field of a "oneof", that essentially said that a JSON type of string implicitly selects this field (and hence the name of the field may be omitted in both serialization and deserialization.)
Since I don't think anything like this already exists, the first good implementation could end up as a de-facto standard.

commented

I see. I think that's a great idea, but I also think it's not a feature that Evans should have.
Evans is a general-purpose gRPC client, nothing more, nothing less, a second-class citizen in the toolset; the definition files by Protocol Buffers should follow the standard, and Evans should just interpret them.

However, it is important to improve the usability of Evans, and we believe that we should continue to work on this issue, as improving the usability of Evans and complying with standards are not exclusive.

I'm going to close this issue as there are already several issues with suggestions for improvement.

Thanks.