Google cloud platform 部署Google云端点配置失败Google API Linter建议

Google cloud platform 部署Google云端点配置失败Google API Linter建议,google-cloud-platform,protocol-buffers,grpc,google-cloud-endpoints,google-api-linter,Google Cloud Platform,Protocol Buffers,Grpc,Google Cloud Endpoints,Google Api Linter,在完成以下操作之后,我成功地部署了编译的.proto文件和gRPC API配置文件 太好了。我决定做一个好公民,使用我的.proto 这导致了一些建议,包括各种注释。注释需要新的proto导入 之前 syntax=“proto3”; 包装api.v1; //Get方法的请求消息。 消息GetFooRequest{ //该字段将包含请求的资源的名称。 字符串名称=1; } ……诸如此类 之后 syntax=“proto3”; 包装api.v1; 导入“google/api/annotations

在完成以下操作之后,我成功地部署了编译的
.proto
文件和gRPC API配置文件

太好了。我决定做一个好公民,使用我的
.proto

这导致了一些建议,包括各种注释。注释需要新的
proto
导入

之前

syntax=“proto3”;
包装api.v1;
//Get方法的请求消息。
消息GetFooRequest{
//该字段将包含请求的资源的名称。
字符串名称=1;
}
……诸如此类
之后

syntax=“proto3”;
包装api.v1;
导入“google/api/annotations.proto”;
导入“google/api/client.proto”;
导入“google/api/field\u behavior.proto”;
导入“google/api/resource.proto”;
//Get方法的请求消息。
消息GetFooRequest{
//该字段将包含请求的资源的名称。
字符串名称=1[
(google.api.field_behavior)=必选,
(google.api.resource\u reference).type=“api.v1.HelloWorld/Foo”
];
}
……诸如此类
注释需要导入四个新的原型文件:

import“google/api/annotations.proto”;
导入“google/api/client.proto”;
导入“google/api/field\u behavior.proto”;
导入“google/api/resource.proto”;
所有这些都是protos的一部分,因此我将它们克隆到了
/Users/Jack/api common protos/

git clone https://github.com/googleapis/api-common-protos.git
…并在编译我的
.proto
文件时包含它:

python3 -m grpc_tools.protoc --proto_path=api
                             --proto_path=/Users/Jack/api-common-protos/google
                             api/v1/foo.proto
没有错误。伟大的最后,我部署API:

gcloud endpoints services deploy api_descriptor.pb api-config.yaml
这就完成了。但是,开发人员门户现在显示:

We encountered the following errors while processing this API specification:

API parse error: Error: ENOENT: no such file or directory, open '/tmp/google/api/client.proto'

Please correct these errors and try again.
克罗特:


如果我删除注释(以及所需的导入),那么我的API的Endpoints Developer Portal工作正常。

这是开发人员门户中的一个bug。我已经向负责的团队报告了此事。

暂时解决这个问题可能不需要太多努力:

cp /Users/Jack/api-common-protos/google/api/client.proto /tmp/google/api/client.proto

然后,该文件将在预期的位置可用,尽管没有自动放在那里。

似乎“protoc”正在查找该文件
/tmp/google/api/client.proto
,而您克隆的存储库中的该文件位于
/Users/Jack/api common protos/google/api/client.proto
下,这是一个有趣的提示,由于您添加了这些工具,您可以使用其他工具自动生成客户端库:请参阅、和的这些工具。@nareddyt,您找到解决此问题的方法了吗?@nareddyt对此有任何更新吗?我有点惊讶,如果端点门户在修复之前仍然不可用,它的优先级并没有提高。不,这个问题还没有修复。其他社区用户通过在部署到云端点之前使用脚本清除注释来解决此问题: