Support multiple proto descriptor files

24 views
Skip to first unread message

Ricardo Cuenca

unread,
Apr 12, 2021, 4:01:00 PMApr 12
to api-gateway-users
When creating a configuration with multiple grpc services, like so:

type: google.api.Service
config_version: 3
name: myapp.apigateway.my-project.cloud.goog
title: API Gateway
apis:
- name: foo.v1.FooService
- name: bar.v1.BarService
[...]

(or multiple config files, one per service), which are declared in separate proto files

/foo/v1/foo_service.proto
/bar/v1/bar_service.proto

one can't create descriptor sets for each service and upload everything at once with 

gcloud api-gateway api-configs create [...] --grpc-files=path/to/foo_config.yaml,path/to/bar_config.yaml,path/to/foo_descriptor_set.pb,path/to/bar_descriptor_set.pb

This will cause the last descriptor set to overwrite the previous one, so that in this example you would get an error claiming that  FooService can't be resolved.
To fix this, one has to compile both services together to create a single descriptor set. I feel like it should be possible to upload multiple descriptor sets simultaneously, which fits in more naturally with service-grouped compilation (eg in bazel typically each service directory would contain a build rule with a descriptor_set rule). Does this make sense or is using a single descriptor set a best practice™ (probably can avoid duplication at compile time, but should be possible to dedup later) enforced by api gateway?
Reply all
Reply to author
Forward
0 new messages