Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using well known types in protobuf file fails with grpc-gen #2346

Closed
1 of 2 tasks
WaDelma opened this issue Oct 17, 2019 · 0 comments · Fixed by #2347
Closed
1 of 2 tasks

Using well known types in protobuf file fails with grpc-gen #2346

WaDelma opened this issue Oct 17, 2019 · 0 comments · Fixed by #2347

Comments

@WaDelma
Copy link
Contributor

WaDelma commented Oct 17, 2019

Issue Type:

  • Bug report
  • Feature request

What happened:

I tried to import:

import "google/protobuf/timestamp.proto";

and then use it:

message Message {
    google.protobuf.Timestamp stamp = 1;
}

When calling protocjar.Protoc with --include_std_types I get following kinds of errors:

[ERROR] target/generated-sources/scala/com/google/protobuf/TimestampProto.pb.scala:11: error: com.google.protobuf.Option does not take type parameter
[ERROR]     `seconds`: Option[Long] = None,                                                                                                                                                           
[ERROR]                ^                                                                                 
[ERROR] target/generated-sources/scala/com/google/protobuf/TimestampProto.pb.scala:12: error: com.google.protobuf.Option does not take type parameter
[ERROR]     `nanos`: Option[Int] = None                                                                                                                                                               
[ERROR]              ^                                                                                   
[ERROR] target/generated-sources/scala/com/google/protobuf/TimestampProto.pb.scala:19: error: com.google.protobuf.Option does not take type parameter
[ERROR]         var secondsArg: Option[Long] = None                                                      
[ERROR]                         ^                                                                                                                                                                     
[ERROR] target/generated-sources/scala/com/google/protobuf/TimestampProto.pb.scala:20: error: com.google.protobuf.Option does not take type parameter
[ERROR]         var nanosArg: Option[Int] = None                                                                                                                                                      
[ERROR]                       ^                                                                                                                                                                       
[ERROR]  target/generated-sources/scala/com/google/protobuf/TimestampProto.pb.scala:29: error: class com.google.protobuf.Option is not a value        
[ERROR]                   secondsArg = Option(pbis.readInt64())                                                                                                                                       
[ERROR]                                ^                                                                 
[ERROR] target/generated-sources/scala/com/google/protobuf/TimestampProto.pb.scala:36: error: class com.google.protobuf.Option is not a value
[ERROR]                   nanosArg = Option(pbis.readInt32())                                            
[ERROR]                              ^                                                                   
[ERROR] target/generated-sources/scala/com/google/protobuf/TimestampProto.pb.scala:51: error: type mismatch;                                         
[ERROR]  found   : Any                                                                                   
[ERROR]  required: Long                                                                                                                                                                               
[ERROR]             pbos.writeInt64(1, value)                                                                                                                                                         
[ERROR]                                ^                                                                 
[ERROR] target/generated-sources/scala/com/google/protobuf/TimestampProto.pb.scala:57: error: type mismatch;
[ERROR]  found   : Any                                                                                   
[ERROR]  required: Int                                                                                   
[ERROR]             pbos.writeInt32(2, value)                                                                                                                                                         
[ERROR]                                ^                                                                 
[ERROR] target/generated-sources/scala/com/google/protobuf/TimestampProto.pb.scala:66: error: type mismatch;
[ERROR]  found   : Any                                                                                   
[ERROR]  required: Long                                                                                  
[ERROR]             val sz = com.google.protobuf.CodedOutputStream.computeTagSize(1) + com.google.protobuf.CodedOutputStream.computeInt64SizeNoTag(value)
[ERROR]                                                                                                                                            ^
[ERROR] target/generated-sources/scala/com/google/protobuf/TimestampProto.pb.scala:72: error: type mismatch;
[ERROR]  found   : Any
[ERROR]  required: Int
[ERROR]             val sz = com.google.protobuf.CodedOutputStream.computeTagSize(2) + com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(value)
[ERROR]                                                                                                                                            ^
[ERROR] 10 errors found

What you expected to happen:

Timestamp to be built without errors.

How to reproduce it (as minimally and precisely as possible):
Compile the following .proto file:

syntax = "proto3";
package p;
message Option {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant