ktr0731 / evans

Evans: more expressive universal gRPC client
MIT License
4.27k stars 188 forks source link

Skipping field not working with type `google/protobuf/struct.proto` #617

Closed bobbylcraig closed 1 year ago

bobbylcraig commented 1 year ago

Describe the bug

As mentioned in your "skip the rest of the fields" section, some fields are skipped when they're passed over on the call. However, it seems as though the google/protobuf/struct.proto type isn't (I'm not sure if this is limited to this type, but it's the only one I can find that's impacted currently).

Thanks for all the work you put in here!

To reproduce

With proto like...

syntax = "proto3";
package messages;
import "google/protobuf/struct.proto";

service ExampleService {
    rpc SendJson (SendJsonRequest) returns (SendJsonResponse) {}
}

message SendRequest {
    string UserID = 1;
    google.protobuf.Struct Details = 2;
    string OtherThing = 3;
}

message SendResponse {
    string UserID = 1;
    google.protobuf.Struct Details = 2;
    string OtherThing = 3;
}

If I run...

path.morepath.v1.MorePathHere@url:port>call SendJson

user_id (TYPE_STRING) => 123
<repeated> details::fields::key (TYPE_STRING) =>
other_thing (TYPE_STRING) => 

_Note: No values were entered for details or other_thing. Ctrl+D was entered._

I see a request on the server that looks like...

{
    "user_id": "123",
    "details": {}
}

which correctly does not include the other_thing but it does include the details field (the problem).

Expected behavior

With the above input in Evans, I'd expect a request on the server like

{
    "user_id": "123"
}

Environment

ktr0731 commented 1 year ago

Sorry for being so late.

README also says:

By default, Evans digs down each message field automatically.

To avoid this behavior, please specify --dig-manually. With this flag, Evans asks whether continue or skip when the next field is message type.

messages.ExampleService@127.0.0.1:50051> call --dig-manually SendJson
UserID (TYPE_STRING) => 123 
✔ skip
OtherThing (TYPE_STRING) =>
ktr0731 commented 1 year ago

Feel free re-open this issue when you have some questions!

michealroberts commented 2 months ago

This doesn't work, it only seems to dig down or skip on the last field ... and when skip, the call is closed without a response or abort.