I'm trying to use this superb package with buf (https://https://buf.build) and fields that are of type google.protobuf.Timestamp.
I have successfully executed the greeter example, and to achieve that, I added to greeter example HelloRequest a google.protobuf.Timestamp date = 2 [(graphql.field) = {}];
service Greeter {
// gRPC service information
option (graphql.service) = {
host: "localhost:50051"
insecure: true
};
rpc SayHello (HelloRequest) returns (HelloReply) {
// Here is plugin definition
option (graphql.schema) = {
type: QUERY // declare as Query
name: "hello" // query name
};
}
rpc SayGoodbye (GoodbyeRequest) returns (GoodbyeReply) {
// Here is plugin definition
option (graphql.schema) = {
type: QUERY // declare as Query
name: "goodbye" // query name
};
}
}
message HelloRequest {
// Below line means the "name" field is required in GraphQL argument
string name = 1 [(graphql.field) = {required: true}];
google.protobuf.Timestamp date = 2 [(graphql.field) = {
}];
}
When I execute buf generate I get 2024/06/11 14:32:28 [PROTOC-GEN-GRAPHQL] Error: google's ptype "timestamppb" does not implement for now. Failure: plugin protoc-gen-graphql: exit status 1
However, if I cd into api directory and execute "protoc -I. --go_out=.. --go-grpc_out=.. --graphql_out=.. api.proto graphql.proto" everything works fine, and all protobufs are generated.
What am I doing wrongly? Is it a buf issue?
Regards & thanks for this great graphQL <-> gRPC [gateway]
Dear @ysugimoto and other members,
I'm trying to use this superb package with buf (https://https://buf.build) and fields that are of type google.protobuf.Timestamp.
I have successfully executed the greeter example, and to achieve that, I added to greeter example HelloRequest a google.protobuf.Timestamp date = 2 [(graphql.field) = {}];
api.proto file
` // greeter.proto syntax = "proto3";
import "graphql/graphql.proto"; import "google/protobuf/timestamp.proto";
package graphql;
option go_package = "/greeter"; // option go_package = ".;pb";
service Greeter { // gRPC service information option (graphql.service) = { host: "localhost:50051" insecure: true };
rpc SayHello (HelloRequest) returns (HelloReply) { // Here is plugin definition option (graphql.schema) = { type: QUERY // declare as Query name: "hello" // query name }; }
rpc SayGoodbye (GoodbyeRequest) returns (GoodbyeReply) { // Here is plugin definition option (graphql.schema) = { type: QUERY // declare as Query name: "goodbye" // query name }; } }
message HelloRequest { // Below line means the "name" field is required in GraphQL argument string name = 1 [(graphql.field) = {required: true}]; google.protobuf.Timestamp date = 2 [(graphql.field) = { }]; }
message HelloReply { string message = 1; google.protobuf.Timestamp date_only = 2 ; string text_only = 3; }
message GoodbyeRequest { // Below line means the "name" field is required in GraphQL argument string name = 1 [(graphql.field) = {required: true}]; }
message GoodbyeReply { string message = 1; } `
I have buf installed and these are my config files:
buf.yaml
` version: v2 modules:
and
buf.gen.yaml
` version: v2 managed: enabled: true plugins:
local: protoc-gen-graphql out: greeter opt: paths=source_relative `
When I execute
buf generate
I get2024/06/11 14:32:28 [PROTOC-GEN-GRAPHQL] Error: google's ptype "timestamppb" does not implement for now. Failure: plugin protoc-gen-graphql: exit status 1
However, if I cd into api directory and execute "protoc -I. --go_out=.. --go-grpc_out=.. --graphql_out=.. api.proto graphql.proto" everything works fine, and all protobufs are generated.
What am I doing wrongly? Is it a buf issue?
Regards & thanks for this great graphQL <-> gRPC [gateway]
janmpo