This issue arises when I try to deploy my service configuration. I've generated Swagger definitions using protoc-go-automatically, as well as my api_descriptor.pb. I've tracked down the issue to the `apis` object in my api_config.yaml
'location: "api_config.yaml:6"
kind: ERROR
message: "Cannot resolve api \'example.api.v1.MyService\'."
As soon as I introduce a value for apis[0].name it fails validation.
type: google.api.Service
config_version: 3
name: GATEWAY-*-
uc.a.run.apptitle: My API
apis:
- name: example.api.v1.MyService
usage:
rules:
- selector: example.api.v1.MyService.AddPerson
allow_unregistered_calls: true
backend:
rules:
- selector: '*'
address: grpcs://BACKEND-*-
uc.a.run.app
I can successfully use grpcurl `describe` method to retrieve information about the RPC server from the gateway, but no other calls work. I can do the same directly hitting the backend gRPC.
This approach passes validation for spec definitions:
gcloud endpoints services deploy openapi_run.json
This does not:
gcloud endpoints services deploy api_descriptor.pb api_config.yaml
My proto file looks like this:
syntax = "proto3";
package example.api.v1;
import "protoc-gen-openapiv2/options/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";
option java_package = "com.example.api.v1";
option java_multiple_files = true;
option java_outer_classname = "ApiProto";
option go_package = "
github.com/example/api/proto/gen/go/example/api/v1;apipb";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "Gateway";
version: "0.0.1";
},
host: "GATEWAY-*-
uc.a.run.app";
extensions: {
key: "x-google-backend";
value {
struct_value {
fields {
key: "address";
value {
string_value: "
https://BACKEND-*-
uc.a.run.app";
}
}
fields {
key: "protocol";
value {
string_value: "h2";
}
}
}
}
}
};
service MyService {
// endpoint for creating a person
rpc AddPerson(AddPersonRequest) returns (AddPersonResponse) {
option (google.api.http) = {
post: "/v1/person",
body: "*"
};
}
message AddPersonRequest {
string email = 1;
string name = 2;
}
message AddPersonResponse {
string id = 1;
string name = 2;
string display_name = 3;
google.protobuf.Timestamp create_time = 4;
}
}