googleapis / googleapis/ruby-core-libraries

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

Open
#57 0 comments 0 reactions 1 assignee Claimed by @aandreassa View on GitHub
Dominant language
Ruby
Stars
14
Forks
12
PR merge metrics
No merged PRs in 30d

Description

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

```ruby
# 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).

```ruby
# 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.