Skip to content

Commit 70c6cc4

Browse files
authored
fix: add api_version breadcrumb to client docs (#1242)
1 parent c06ea88 commit 70c6cc4

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

gapic-generator/lib/gapic/schema/wrappers.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,18 @@ def full_name
347347
@address.join "."
348348
end
349349

350+
# @private
351+
# This is an override that adds mention of the client's service and API
352+
# version if the service has a google.api.api_version set.
353+
def docs_leading_comments disable_xrefs: false, transport: nil
354+
str = super(disable_xrefs: disable_xrefs, transport: transport)
355+
if !str || api_version.nil? || api_version.empty?
356+
return str
357+
end
358+
359+
"#{str.strip}\n\nThis client uses #{name} version #{api_version}."
360+
end
361+
350362
# @!method name
351363
# @return [String] the unqualified name of the service.
352364
# @!method options

shared/output/gapic/templates/showcase/lib/google/showcase/v1beta1/echo.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ module V1beta1
4747
# 'x-goog-request-params' metadata key on any method to have the values
4848
# echoed in the response headers.
4949
#
50+
# This client uses Echo version v1_20240408.
51+
#
5052
# @example Load this service and instantiate a gRPC client
5153
#
5254
# require "google/showcase/v1beta1/echo"

shared/output/gapic/templates/showcase/lib/google/showcase/v1beta1/echo/client.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ module Echo
4444
# 'x-goog-request-params' metadata key on any method to have the values
4545
# echoed in the response headers.
4646
#
47+
# This client uses Echo version v1_20240408.
48+
#
4749
class Client
4850
# @private
4951
API_VERSION = "v1_20240408"

shared/output/gapic/templates/showcase/lib/google/showcase/v1beta1/echo/rest.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ module V1beta1
4747
# 'x-goog-request-params' metadata key on any method to have the values
4848
# echoed in the response headers.
4949
#
50+
# This client uses Echo version v1_20240408.
51+
#
5052
# To load this service and instantiate a REST client:
5153
#
5254
# require "google/showcase/v1beta1/echo/rest"

shared/output/gapic/templates/showcase/lib/google/showcase/v1beta1/echo/rest/client.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ module Rest
4646
# 'x-goog-request-params' metadata key on any method to have the values
4747
# echoed in the response headers.
4848
#
49+
# This client uses Echo version v1_20240408.
50+
#
4951
class Client
5052
# @private
5153
API_VERSION = "v1_20240408"

0 commit comments

Comments
 (0)