You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
Generator should skip generation for empty services #2750
There tests fail when trying to compile the generated library containing this proto which means the generator is generating some classes for this empty service which are not compilable. The generator instead should skip generation for an empty service.
Skip generation clients if no RPCs found for a service.
Generate an empty client, no ideal but maybe there is a use case for empty clients.
Currently I am opting for option 1 in #3051, to skip generation altogether if no RPCs found in a service (filter in parsing services). However, I run into a conflict with this test, and discovered this relative old pr that put on a check for empty services for sample composers.
The above pr only fixes for sample code composers, thus we are still observing this behavior as reported in this issue.
The behavior in above pr still generates samples for empty services, while discussion on the pr seams to suggest it was a quick fix to not error out and author and reviewers seems to have consensus that services without RPCs should not be a thing.
this was originally a fix to enable sqladmin API, but I don’t see sql admin generated in google-cloud-java. Any context?
I want to run this quickly by @blakeli0 to check if you think it's okay to not generate clients for empty services that do not have RPCs? Or otherwise, is empty services like this one a legit use case?
Thanks for the investigation @zhumin8 ! I don't think this is a legit use case, the PR was probably trying to resolve a presubmit check internally when this proto was introduced.
Since the specific service never request generation for a Java library, means there would be no breaking change once this issue is fixed, I think we are safe to not generating clients for empty services.
Activity
blakeli0 commentedon May 28, 2024
Similar issue #2050 where the gapic generator errors out if no service exists.
blakeli0 commentedon May 28, 2024
Possible solutions:
zhumin8 commentedon Jul 16, 2024
Currently I am opting for option 1 in #3051, to skip generation altogether if no RPCs found in a service (filter in parsing services). However, I run into a conflict with this test, and discovered this relative old pr that put on a check for empty services for sample composers.
I want to run this quickly by @blakeli0 to check if you think it's okay to not generate clients for empty services that do not have RPCs? Or otherwise, is empty services like this one a legit use case?
blakeli0 commentedon Jul 16, 2024
Thanks for the investigation @zhumin8 ! I don't think this is a legit use case, the PR was probably trying to resolve a presubmit check internally when this proto was introduced.
Since the specific service never request generation for a Java library, means there would be no breaking change once this issue is fixed, I think we are safe to not generating clients for empty services.
fix: Generator to skip generation for empty services. (#3051)
fix: Generator to skip generation for empty services. (#3051)