gpt4 book ai didi

google-cloud-platform - 部署 Google Cloud Endpoints 配置失败 Google API Linter 建议

转载 作者:行者123 更新时间:2023-12-01 15:18:42 24 4
gpt4 key购买 nike

关注后 Deploying the Endpoints configuration我已经成功部署了我编译的 .proto文件和 gRPC API 配置文件。

伟大的。我决定做一个好公民并使用Google's API Linter在我的 .proto .

这导致了许多建议,包括各种注释。注释需要新 proto进口;

之前

syntax = "proto3";
package api.v1;

// Request message for Get method.
message GetFooRequest {
// The field will contain name of the resource requested.
string name = 1;
}

...blah,blah



syntax = "proto3";
package api.v1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";

// Request message for Get method.
message GetFooRequest {
// The field will contain name of the resource requested.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "api.v1.HelloWorld/Foo"
];
}
...blah,blah

注释需要导入四个新的 proto 文件:

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";

都是 Google's Common API 的一部分protos,因此我克隆了 the repo进入 /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

这就完成了。但是,Developer Portal 现在显示:
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.

外链:

enter image description here

如果我删除注释(和必需的导入),我的 API 的端点开发人员门户就可以正常工作。

最佳答案

这是开发人员门户中的错误。我已经向负责的团队报告了。

关于google-cloud-platform - 部署 Google Cloud Endpoints 配置失败 Google API Linter 建议,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59997578/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com