Skip to content

fix(generator): filter out empty services from api.services#8686

Merged
shivanee-p merged 3 commits into
mainfrom
shivaneep-empty-service-generation
Jun 23, 2026
Merged

fix(generator): filter out empty services from api.services#8686
shivanee-p merged 3 commits into
mainfrom
shivaneep-empty-service-generation

Conversation

@shivanee-p

@shivanee-p shivanee-p commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

The TypeScript generator does not generate the corresponding client class files if the proto files have services with zero RPC methods, resulting in compilation failures due to missing client file imports (e.g. Cannot find module './sql_available_database_versions_service_client').

This recently caused build failures in the google-cloud-sql package regeneration (PR 8626), which defines several empty placeholder/internal services like SqlRegionsService and SqlEventsService.

This PR filters out "empty" services from the services collection in the API schema generator class (core/generator/gapic-generator-typescript/typescript/src/schema/api.ts).

A service is considered empty and skipped if it has:

  • Zero native RPC methods defined in the proto file.
  • No mixins enabled (such as IAMPolicy or Locations) that would inject mixed-in methods.

This prevents the generator from producing client classes and index.ts exports for non-functional empty services.

Testing

  • Local Regeneration: Regenerated google-cloud-sql client code locally. Confirmed that the empty services (like SqlRegionsService, SqlEventsService, etc.) are no longer generated or exported, resulting in a successful compile.
  • Mixin Verification: Verified that google-cloud-dataplex (ContentService), which defines zero native methods but has IAMPolicy and Locations mixins configured, is still correctly generated and exported as expected.
    Unit Tests: Ran all 155 unit tests of the generator; all passed successfully with no regressions.

@shivanee-p shivanee-p requested a review from a team as a code owner June 18, 2026 20:45

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the default owner and team members in the CODEOWNERS file, and filters services in the TypeScript GAPIC generator to only include those with methods or specific mixins (IAMPolicyMixin, LocationMixin). Feedback was provided to improve the service filtering logic by using idiomatic truthy checks (!!) instead of comparing potentially boolean or undefined mixin properties with > 0.

Comment thread core/generator/gapic-generator-typescript/typescript/src/schema/api.ts Outdated
@shivanee-p shivanee-p force-pushed the shivaneep-empty-service-generation branch from 9d255e0 to cabde93 Compare June 18, 2026 20:51
@shivanee-p shivanee-p force-pushed the shivaneep-empty-service-generation branch from cabde93 to 7fd2d1c Compare June 18, 2026 22:59
…a/api.ts

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@shivanee-p shivanee-p requested review from feywind and removed request for a team June 22, 2026 21:13
@shivanee-p shivanee-p merged commit aae55b3 into main Jun 23, 2026
47 checks passed
@shivanee-p shivanee-p deleted the shivaneep-empty-service-generation branch June 23, 2026 19:15
@pearigee

Copy link
Copy Markdown
Contributor

Hey @shivanee-p is this something we could add an extra unit test to verify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants