Skip to content
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
This repository was archived by the owner on Oct 29, 2026. It is now read-only.

Generator should skip generation for empty services #2750

Closed

Description

@alicejli

A scenario came up with googleapis/google-cloud-java#10802 where https://github.com/googleapis/googleapis/blob/master/google/cloud/visionai/v1/prediction.proto contains an empty service (e.g. no RPCs).

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.

Activity

  1. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on May 7, 2024
  2. blakeli0 commented on May 28, 2024

    @blakeli0
    Contributor

    Similar issue #2050 where the gapic generator errors out if no service exists.

  3. blakeli0 commented on May 28, 2024

    @blakeli0
    Contributor

    Possible solutions:

    1. Skip generation clients if no RPCs found for a service.
    2. Generate an empty client, no ideal but maybe there is a use case for empty clients.
  4. self-assigned this
    on Jun 5, 2024
  5. zhumin8 commented on Jul 16, 2024

    @zhumin8
    Contributor

    Possible solutions:

    1. Skip generation clients if no RPCs found for a service.
    2. 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?

  6. blakeli0 commented on Jul 16, 2024

    @blakeli0
    Contributor

    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.

  7. added a commit that references this issue on Jul 23, 2024
    ff2c485
  8. added a commit that references this issue on Mar 24, 2026
    1af3059
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions