Skip to content

Commit fd4cfca

Browse files
committed
fix: add api_version breadcrumb to client docs
1 parent 480cf13 commit fd4cfca

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/comment/ServiceClientCommentComposer.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,18 @@ public static List<CommentStatement> createClassHeaderComments(
108108
String secondaryTransport) {
109109
JavaDocComment.Builder classHeaderJavadocBuilder = JavaDocComment.builder();
110110
if (service.hasDescription()) {
111+
String description = service.description();
112+
113+
// Include google.api.api_version breadcrumb comment.
114+
if (service.hasApiVersion()) {
115+
description =
116+
String.format(
117+
"%s\n\nThis client uses %s version %s.",
118+
description, service.apiShortName(), service.apiVersion());
119+
}
120+
111121
String descriptionComment =
112-
CommentFormatter.formatAsJavaDocComment(
113-
service.description(), SERVICE_DESCRIPTION_SUMMARY_PATTERN);
122+
CommentFormatter.formatAsJavaDocComment(description, SERVICE_DESCRIPTION_SUMMARY_PATTERN);
114123
classHeaderJavadocBuilder = classHeaderJavadocBuilder.addUnescapedComment(descriptionComment);
115124
}
116125

gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoClient.golden

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ import javax.annotation.Generated;
3535
* methods that explicitly implement server delay, and paginated calls. Set the 'showcase-trailer'
3636
* metadata key on any method to have the values echoed in the response trailers.
3737
*
38+
* This client uses Echo version v1_20240408.
39+
*
3840
* <p>This class provides the ability to make remote calls to the backing service through method
3941
* calls that map to API methods. Sample code to get started:
4042
*

java-showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/EchoClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
* 'x-goog-request-params' metadata key on any method to have the values echoed in the response
6060
* headers.
6161
*
62+
* This client uses Echo version v1_20240408.
63+
*
6264
* <p>This class provides the ability to make remote calls to the backing service through method
6365
* calls that map to API methods. Sample code to get started:
6466
*

0 commit comments

Comments
 (0)