Skip to content

REST ServiceStub should pass &block through to ClientStub.new to enable Faraday connection customization #57

Description

@arianf

Gapic::Rest::ClientStub#initialize already yields the Faraday connection after setup:

# gapic-common/lib/gapic/rest/client_stub.rb:94
yield @connection if block_given?

However, none of the auto-generated ServiceStub classes pass a block through when creating the ClientStub, so this hook is unreachable from the public API.

Use case: Configuring mTLS client certificates on the Faraday connection for services that require mutual TLS authentication (e.g., connecting to an API gateway that validates client certs).

# What we'd like to do:
connection.ssl.client_cert = OpenSSL::X509::Certificate.new(cert_pem)
connection.ssl.client_key  = OpenSSL::PKey::RSA.new(key_pem)

Proposed fix: Update the generator template for REST ServiceStub#initialize to accept and forward &block to ClientStub.new.

Affected version: gapic-common 1.0.0, google-cloud-ai_platform-v1 1.17.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions