grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.65k stars 764 forks source link

protoc generates different files from grpc-web example #774

Closed goodbsw closed 4 years ago

goodbsw commented 4 years ago

  1. This is my proto file

    
    syntax = "proto3";

package calculator;

option go_package = "calculatorpb";

message AddRequest { int32 num1 = 1; int32 num2 = 2; }

message AddResponse { int32 result = 1; }

service Calculator { rpc Add(AddRequest) returns (AddResponse) {}; }


---
2. These are the files from protoc command
---
![image](https://user-images.githubusercontent.com/37948897/78346555-23132900-75da-11ea-8463-6b7e6b9346ba.png)

protoc command from dir containing proto file : protoc calculator.proto --js_out=import_style=common.js,binary:../client --grpc-web_out=import_style=commonjs,mode=grpcwebtext:../client
---
3. Question
---
According to example, only two files (<service>_grpc_web_pb.js, <service>_pb.js)will be generated  after protoc command.
Is there any mistake in command line or am I missing something?
Thank you!
iCovarrubias commented 4 years ago

Most likely _grpc_web_pb.js, _pb.js were generated using an old version of protoc or protoc-gen-grpc-web plugin.

In my opinion what you are getting right now it's more convenient/cleaner, one module for the service and one for each of your messages, plus namespaced.

stanley-cheung commented 4 years ago

@goodbsw which version of the protoc plugin are you using?