Skip to content

Commit b5e050b

Browse files
committed
fix(generator): include API version in client docs
1 parent 46f7e8b commit b5e050b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

generator/integration_tests/golden/v1/golden_kitchen_sink_client.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
3838
///
3939
/// GoldenKitchenSinkClient
4040
///
41+
/// This client uses GoldenKitchenSink version test-api-version.
42+
///
4143
/// @par Equality
4244
///
4345
/// Instances of this class created via copy-construction or copy-assignment

generator/internal/format_class_comments.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "google/cloud/internal/absl_str_replace_quiet.h"
1919
#include "google/cloud/log.h"
2020
#include "absl/strings/strip.h"
21+
#include <google/api/client.pb.h>
2122

2223
namespace google {
2324
namespace cloud {
@@ -78,6 +79,12 @@ std::string FormatClassCommentsFromServiceComments(
7879
{service.name(), service_name}});
7980
}
8081

82+
auto api_version = service.options().GetExtension(google::api::api_version);
83+
if (!api_version.empty()) {
84+
absl::StrAppend(&formatted_comments,
85+
"\n/// This client uses ", service_name, " version ", api_version, ".\n");
86+
}
87+
8188
auto const references =
8289
ResolveCommentReferences(formatted_comments, *service.file()->pool());
8390
auto trailer = std::string{};

0 commit comments

Comments
 (0)