fullstorydev / grpcurl

Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers
MIT License
10.96k stars 508 forks source link

grpcurl describe: proto import failure #299

Open kostiamol opened 2 years ago

kostiamol commented 2 years ago

command:

grpcurl \
-import-path dir/schema/protobuf/test \
-import-path github.com/googleapis/google/type/money.proto \
-proto dir/schema/protobuf/test/test.proto \
describe prototest.Price.FetchPriceByArticleId

output: Failed to process proto source files.: could not parse given files: test.proto:8:8: open dir/schema/protobuf/test/google/type/money.proto: no such file or directory

working directory is parent for both dir and github.com

dir/schema/protobuf/test/test.proto

syntax = "proto3";
package test;

import "google/type/money.proto";
import "google/rpc/status.proto";

service Prices {
  rpc FetchPriceByArticleId (FetchPriceByArticleIdRequest) returns (FetchPriceByArticleIdResponse) {};
}

message FetchPriceByArticleIdRequest {
  google.type.Money price_supply = 1;
  google.type.Money price_retail = 2;
}

message FetchPriceByArticleIdResponse {
  google.rpc.Status status = 1;
  google.type.Money price_retail = 2;
}
murthy95 commented 2 years ago

Try this

grpcurl \
-import-path github.com/googleapis \
-proto dir/schema/protobuf/test/test.proto \
describe prototest.Price.FetchPriceByArticleId