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

proto gen: support optionals in proto syntax 3 #104

Closed
aadedamola opened this issue Mar 16, 2022 · 3 comments
Closed

proto gen: support optionals in proto syntax 3 #104

aadedamola opened this issue Mar 16, 2022 · 3 comments

Comments

@aadedamola
Copy link
Contributor

aadedamola commented Mar 16, 2022

Anytime I use this plugin to generate code from a proto file, I get this error message:

example.proto is a proto3 file that contains optional fields, but code generator protoc-gen-goclay hasn't been updated to support optional fields in proto3. Please ask the owner of this code generator to support proto3 optional.--goclay_out:

Since this update supports optionals by default, we should support optionals during code generation?

@bullgare
Copy link
Contributor

Do you have a simple proto file as an example?

@aadedamola
Copy link
Contributor Author

Thanks @bullgare. Here is a sample proto.

package example;

option go_package = "./pkg/example;exampleservice";

import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "protoc-gen-swagger/options/annotations.proto";

service ExampleService {
  // Add two nullables
  rpc Add(Request) returns (Response) {
    option (google.api.http) = {
      post: "/api/v1/add"
      body: "*"
    };
  }
}

message Request {
  optional int64 value1 = 1;
  optional int64 value2 = 2;
}

message Response {
  int64 sum = 1;
}

@utrack
Copy link
Owner

utrack commented Mar 23, 2022

Thanks a lot! Published with v3.1.0

@utrack utrack closed this as completed Mar 23, 2022
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

No branches or pull requests

3 participants