Adven27 / grpc-wiremock

gRPC Mock Server
MIT License
93 stars 40 forks source link

INVALID_ARGUMENT: Failed to convert to class #12

Closed deepnirmal closed 3 years ago

deepnirmal commented 3 years ago

Sample proto snapshot

package test.v1 import "google/protobuf/timestamp.proto";

option java_multiple_files = true; option go_package = "testv1"; option java_package = "com.test.v1"; option java_outer_classname = "V1Proto";

message Employee { string name = 1; string id = 2; google.protobuf.Timestamp time_stamp = 3; }

Wiremock STUB - JSON body: {"name":"test", "id":"test123", "time_stamp" : { "seconds":"1616782696" , "nanos":0 } }

Error in bloomRPC: { "error": "3 INVALID_ARGUMENT: Failed to convert { //////. to class something something }

Adven27 commented 3 years ago

I've placed test.proto file with content from your comment to example/proto dir:

$ cat example/proto/test.proto 
package test.v1
import "google/protobuf/timestamp.proto";

option java_multiple_files = true;
option go_package = "testv1";
option java_package = "com.test.v1";
option java_outer_classname = "V1Proto";

message Employee {
  string name = 1;
  string id = 2;
  google.protobuf.Timestamp time_stamp = 3;
}

And run the container:

$ docker run -p 8888:8888 -p 50000:50000 -v $(pwd)/example/proto:/proto adven27/grpc-wiremock
Initialized native services in: /home/gradle/.gradle/native

...omitted for brevity...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generateProto'.
> protoc: stdout: . stderr: [libprotobuf WARNING ../../../../../src/google/protobuf/compiler/parser.cc:648] No syntax specified for the proto file: test.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
  test.proto:2:1: Expected ";".
  test.proto:10:3: Expected "required", "optional", or "repeated".
  test.proto:11:3: Expected "required", "optional", or "repeated".
  test.proto:12:3: Expected "required", "optional", or "repeated".

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 18s
3 actionable tasks: 3 executed

Here are the errors from proto compiler:

> protoc: stdout: . stderr: [libprotobuf WARNING ../../../../../src/google/protobuf/compiler/parser.cc:648] No syntax specified for the proto file: test.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
  test.proto:2:1: Expected ";".
  test.proto:10:3: Expected "required", "optional", or "repeated".
  test.proto:11:3: Expected "required", "optional", or "repeated".
  test.proto:12:3: Expected "required", "optional", or "repeated".

@deepnirmal do you sure your proto is valid?

After fixing this message Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. and this one test.proto:2:1: Expected ";". file looks like this:

$ cat example/proto/test.proto 
syntax = "proto3";
package test.v1;
import "google/protobuf/timestamp.proto";

option java_multiple_files = true;
option go_package = "testv1";
option java_package = "com.test.v1";
option java_outer_classname = "V1Proto";

message Employee {
  string name = 1;
  string id = 2;
  google.protobuf.Timestamp time_stamp = 3;
}

and container has started:

$ docker run -p 8888:8888 -p 50000:50000 -v $(pwd)/example/proto:/proto adven27/grpc-wiremock
Initialized native services in: /home/gradle/.gradle/native

...omitted for brevity...

2021-05-10 09:45:23.546  INFO 109 --- [           main] io.adven.grpc.wiremock.GrpcWiremock      : Started ServerImpl{logId=2, transportServers=[NettyServer{logId=1, address=0.0.0.0/0.0.0.0:50000}]}
Registered services:
 * grpc.reflection.v1alpha.ServerReflection
 * api.wallet.WalletService
 * api.wallet.BalanceService
Adven27 commented 3 years ago

Please, reopen if the issue persists