Closed ashashev closed 9 months ago
Calling of gRPC stub fails if the stub contains proto-scheme with nested enum. Regardless of whether message with the nested enum is used or not.
The following proto-file occurs the problem.
syntax = "proto3"; message Request { string text = 1; } message Response { enum Code { OK = 0; FAIL = 1; } optional Code code = 1; } service Service { rpc Call (Request) returns (Response); }
Creating service:
curl -X POST -d '{"suffix":"first", "name":"first"}' http://localhost:8228/api/internal/mockingbird/v2/service
Creating a stub using the prototype above:
curl -i -X POST localhost:8228/api/internal/mockingbird/v2/grpcStub -d \ '{ "name": "GRPC ***", "labels": [], "scope": "persistent", "methodName": "Service/Call", "requestCodecs": "c3ludGF4ID0gInByb3RvMyI7CgptZXNzYWdlIFJlcXVlc3QgewogICAgc3RyaW5nIHRleHQgPSAxOwp9CgptZXNzYWdlIFJlc3BvbnNlIHsKICAgIGVudW0gQ29kZSB7CiAgICAgIE9LID0gMDsKICAgICAgRkFJTCA9IDE7CiAgICB9CiAgICBvcHRpb25hbCBDb2RlIGNvZGUgPSAxOwp9CgpzZXJ2aWNlIFNlcnZpY2UgewogICAgcnBjIENhbGwgKFJlcXVlc3QpIHJldHVybnMgKFJlc3BvbnNlKTsKfQo=", "requestClass": "Request", "requestPredicates": {}, "responseCodecs": "c3ludGF4ID0gInByb3RvMyI7CgptZXNzYWdlIFJlcXVlc3QgewogICAgc3RyaW5nIHRleHQgPSAxOwp9CgptZXNzYWdlIFJlc3BvbnNlIHsKICAgIGVudW0gQ29kZSB7CiAgICAgIE9LID0gMDsKICAgICAgRkFJTCA9IDE7CiAgICB9CiAgICBvcHRpb25hbCBDb2RlIGNvZGUgPSAxOwp9CgpzZXJ2aWNlIFNlcnZpY2UgewogICAgcnBjIENhbGwgKFJlcXVlc3QpIHJldHVybnMgKFJlc3BvbnNlKTsKfQo=", "responseClass": "Response", "response": { "mode": "fill", "data": { "code": "OK" } }, "state": null, "seed": null, "service": "first" }' \
Calling the stub:
grpcurl \ -proto bad.proto \ -d '{ "text": "qwe123" }' \ -plaintext localhost:9000 \ 'Service/Call'
The expected result of this call, it is successful and returns { "code": "OK" }, but in reality it returns an error.
{ "code": "OK" }
@mockingbird/maintainers
Problem
Calling of gRPC stub fails if the stub contains proto-scheme with nested enum. Regardless of whether message with the nested enum is used or not.
Steps to reproduce bugs
The following proto-file occurs the problem.
Creating service:
Creating a stub using the prototype above:
Calling the stub:
The expected result of this call, it is successful and returns
{ "code": "OK" }
, but in reality it returns an error.@mockingbird/maintainers