gapic-generator 0.7.5 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +45 -0
  3. data/lib/gapic/generator/version.rb +1 -1
  4. data/lib/gapic/generators/default_generator.rb +11 -1
  5. data/lib/gapic/generators/default_generator_parameters.rb +3 -1
  6. data/lib/gapic/presenters.rb +2 -0
  7. data/lib/gapic/presenters/gem_presenter.rb +63 -10
  8. data/lib/gapic/presenters/method/rest_pagination_info.rb +246 -0
  9. data/lib/gapic/presenters/method_presenter.rb +21 -2
  10. data/lib/gapic/presenters/method_rest_presenter.rb +70 -4
  11. data/lib/gapic/presenters/resource_presenter.rb +8 -0
  12. data/lib/gapic/presenters/service_config_presenter.rb +48 -0
  13. data/lib/gapic/presenters/service_presenter.rb +69 -0
  14. data/lib/gapic/presenters/service_rest_presenter.rb +36 -28
  15. data/lib/gapic/presenters/snippet_presenter.rb +103 -0
  16. data/lib/gapic/schema/api.rb +32 -8
  17. data/lib/gapic/schema/request_param_parser.rb +2 -2
  18. data/lib/gapic/schema/wrappers.rb +26 -0
  19. data/templates/default/gem/readme.erb +3 -3
  20. data/templates/default/lib/rest/_rest.erb +0 -2
  21. data/templates/default/service/client/_client.erb +18 -20
  22. data/templates/default/service/client/_config.erb +13 -14
  23. data/templates/default/service/client/_credentials.erb +2 -0
  24. data/templates/default/service/client/_operations.erb +1 -1
  25. data/templates/default/service/client/_paths.erb +1 -1
  26. data/templates/default/service/client/_self_configure_defaults.erb +2 -2
  27. data/templates/default/service/client/method/_def.erb +2 -0
  28. data/templates/default/service/client/method/def/_options_defaults.erb +3 -1
  29. data/templates/default/service/client/method/docs/_deprecated.erb +5 -0
  30. data/templates/default/service/client/method/docs/_snippets.erb +6 -0
  31. data/templates/default/service/rest/client/_client.erb +15 -24
  32. data/templates/default/service/rest/client/_config.erb +48 -0
  33. data/templates/default/service/rest/client/method/_def.erb +1 -1
  34. data/templates/default/service/rest/client/method/def/_options_defaults.erb +7 -3
  35. data/templates/default/service/rest/client/method/def/_response.erb +6 -0
  36. data/templates/default/service/rest/client/method/def/_response_normal.erb +4 -15
  37. data/templates/default/service/rest/client/method/def/_response_paged.erb +7 -0
  38. data/templates/default/service/rest/client/method/docs/_result.erb +3 -3
  39. data/templates/default/service/rest/service_stub.erb +6 -0
  40. data/templates/default/service/rest/service_stub/_service_stub.erb +25 -0
  41. data/templates/default/service/rest/{grpc_transcoding/method → service_stub/grpc_transcoding_method}/_def.erb +4 -1
  42. data/templates/default/service/rest/{grpc_transcoding/method → service_stub/grpc_transcoding_method}/def/_query_string_param.erb +0 -0
  43. data/templates/default/service/rest/service_stub/method/_def.erb +20 -0
  44. data/templates/default/service/rest/service_stub/method/def/_request.erb +2 -0
  45. data/templates/default/service/rest/service_stub/method/def/_response.erb +17 -0
  46. data/templates/default/service/rest/test/client.erb +18 -0
  47. data/templates/default/service/rest/test/method/_assert_response.erb +2 -0
  48. data/templates/default/service/rest/test/method/_configure.erb +19 -0
  49. data/templates/default/service/rest/test/method/_normal.erb +71 -0
  50. data/templates/default/service/rest/test/method/_setup.erb +38 -0
  51. data/templates/default/service/test/client_paths.erb +1 -1
  52. data/templates/default/snippets/gemfile.erb +17 -0
  53. data/templates/default/snippets/snippet/_structure.erb +71 -0
  54. data/templates/default/snippets/standalone.erb +6 -0
  55. metadata +29 -12
  56. data/templates/default/service/client/_self_configure_retry_policy.erb +0 -15
  57. data/templates/default/service/rest/client/_requires.erb +0 -1
  58. data/templates/default/service/rest/grpc_transcoding/_grpc_transcoding.erb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbb07888e227a0e891359dd684e8ead50be011593929d56a929a9b1e226a8257
4
- data.tar.gz: 1ef99fe476ca10728df3997f3a01a87e12cf3f681ecb7f1c07e17facbd3ecd7a
3
+ metadata.gz: 36abe40caa29f9c1368fc86632e1c57703d98346ab5dd70ad1a87ba7e73b277c
4
+ data.tar.gz: 60479a28e6d38873d21f06200f554e874ae2df926929e6eaef0a33e9b3099de5
5
5
  SHA512:
6
- metadata.gz: 535fa4c595fc7c3074c9d554303f275039e8952a908f2b9295b62625f14173ed979e684fb11ed33b7dfbce751001cdb4aaa25e2d9f752252af258336a8ca45c3
7
- data.tar.gz: d36e8866f75c418520142c1b883214540b40261b06e2386ea822fef42de79ebbde38368f21b2bcf726871f64bb12b1e4b4bf8be70d043e44e026f8c41f8ccf23
6
+ metadata.gz: 970f3a69d280a1cdad3bd53554d48d89524528ae65033e9a469ce4be3ccd9da83d8bd1bb4a28a6d45d9989456398b8421876eaaa39e1eaf179e28573b6ded107
7
+ data.tar.gz: 41b9678039126730f3295f63cdd20d298516060b3965091888c47cec944863f7dba01d7d5254327c13477053bdcc4425e500a42cf63e620befda2addb0e85c7b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # Release History for gapic-generator
2
2
 
3
+ ### 0.10.0 / 2021-08-09
4
+
5
+ * New: Enabled per-RPC configuration for generated REST libraries
6
+ * New: Generated docs include the deprecated YARD tag for deprecated protos
7
+ * New: Scopes can be passed to self-signed JWTs
8
+ * Fixed: Generated gRPC clients honor the client-default timeout config
9
+ * Fixed: Generated docs now use YARD example tags for inline samples related to configuration
10
+ * Fixed: Generated REST clients now require google/cloud/errors
11
+ * Generated libraries now require gapic-common 0.7.0 or later
12
+
13
+ ### 0.9.2 / 2021-07-27
14
+
15
+ * REST libraries are now generated with pagination hepers
16
+ * REST libraries are now generated with correct examples in README.md and other documentation files
17
+ * It is now possible to generate inline snippets in yardocs
18
+ * Fixed the require path in the generated standalone snippets so it reflects the recommended require root rather than the service-specific require path.
19
+ * Prevent "duplicate" resources (with the same name but different namespaces) from producing duplicate helper methods.
20
+
21
+ ### 0.9.1 / 2021-07-07
22
+
23
+ * Detect multiple resource parents for patterns used by multiple resources
24
+
25
+ ### 0.9.0 / 2021-06-29
26
+
27
+ * Support for configuring the service/method used for the quickstart example
28
+ * Allow generation of libraries with no custom env prefix
29
+ * Add service override setting to the repo metadata
30
+ * Wrapper gem dependencies on pre-GA versioned gems now allow both 0.x and 1.x versions
31
+ * Scoped some String and Hash references to the global scope to avoid name collisions
32
+ * Reformat some config code to avoid rubocop indentation churn
33
+ * Bazel: Replace monolith deps with rules_gapic
34
+
35
+ ### 0.8.0 / 2021-06-16
36
+
37
+ * Initial implementation of standalone snippet generation.
38
+ * Updated gapic-common dependencies to require at least 0.5 and to support future 1.x versions.
39
+ * Generated unit tests for REST clients.
40
+ * Generated proper x-goog-api-client headers for REST clients.
41
+ * Added generation arguments to generated repo metadata.
42
+ * Allow multiple versions in the extra-dependency command line argument.
43
+ * Fixed treatment of boolean-valued command line arguments to the generator.
44
+ * Fixed behavior of wrapper-gem-override if given an empty value.
45
+ * Fixed default env_prefix computation to avoid the version part of the proto namespace.
46
+ * Fixed Bazel front-end to preserve file permissions.
47
+
3
48
  ### 0.7.5 / 2021-05-18
4
49
 
5
50
  * Bazel jobs now provide a prebuilt ruby binary.
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Gapic
18
18
  module Generator
19
- VERSION = "0.7.5"
19
+ VERSION = "0.10.0"
20
20
  end
21
21
  end
@@ -60,10 +60,18 @@ module Gapic
60
60
  files << g("service/paths.erb", "lib/#{service.paths_file_path}", service: service) if service.paths?
61
61
  files << g("service/operations.erb", "lib/#{service.operations_file_path}", service: service) if service.lro? && !@api.generate_rest_clients?
62
62
  files << g("service/rest/client.erb", "lib/#{service.rest.client_file_path}", service: service) if @api.generate_rest_clients? and service.methods_rest_bindings?
63
- files << g("service/rest/grpc_transcoding.erb", "lib/#{service.rest.transcoding_helper_file_path}", service: service) if @api.generate_rest_clients? and service.methods_rest_bindings?
63
+ files << g("service/rest/service_stub.erb", "lib/#{service.rest.service_stub_file_path}", service: service) if @api.generate_rest_clients? and service.methods_rest_bindings?
64
+ files << g("service/rest/test/client.erb", "test/#{service.rest.test_client_file_path}", service: service) if @api.generate_rest_clients? and service.methods_rest_bindings?
64
65
  files << g("service/test/client.erb", "test/#{service.test_client_file_path}", service: service) unless @api.generate_rest_clients?
65
66
  files << g("service/test/client_paths.erb", "test/#{service.test_paths_file_path}", service: service) if service.paths?
66
67
  files << g("service/test/client_operations.erb", "test/#{service.test_client_operations_file_path}", service: service) if service.lro? && !@api.generate_rest_clients?
68
+
69
+ if @api.generate_standalone_snippets?
70
+ service.methods.each do |method|
71
+ snippet = method.snippet
72
+ files << g("snippets/standalone.erb", "snippets/#{snippet.snippet_file_path}", snippet: snippet)
73
+ end
74
+ end
67
75
  end
68
76
  end
69
77
 
@@ -82,6 +90,8 @@ module Gapic
82
90
  files << g("gem/entrypoint.erb", "lib/#{gem.name}.rb", gem: gem)
83
91
  files << g("gem/gapic_metadata_json.erb", "gapic_metadata.json", gem: gem) if @api.generate_metadata
84
92
 
93
+ files << g("snippets/gemfile.erb", "snippets/Gemfile", gem: gem) if @api.generate_standalone_snippets?
94
+
85
95
  gem.proto_files.each do |proto_file|
86
96
  files << g("proto_docs/proto_file.erb", "proto_docs/#{proto_file.docs_file_path}", file: proto_file)
87
97
  end
@@ -24,7 +24,9 @@ module Gapic
24
24
  ":gem.:free_tier",
25
25
  ":gem.:yard_strict",
26
26
  ":gem.:generic_endpoint",
27
- ":generate_metadata"
27
+ ":generate_metadata",
28
+ ":generate_standalone_snippets",
29
+ ":generate_yardoc_snippets"
28
30
  ].freeze
29
31
 
30
32
  STRING_PARAMETERS = [
@@ -26,7 +26,9 @@ require "gapic/presenters/package_presenter"
26
26
  require "gapic/presenters/resource_presenter"
27
27
  require "gapic/presenters/sample_presenter"
28
28
  require "gapic/presenters/service_presenter"
29
+ require "gapic/presenters/service_config_presenter"
29
30
  require "gapic/presenters/service_rest_presenter"
31
+ require "gapic/presenters/snippet_presenter"
30
32
 
31
33
  module Gapic
32
34
  ##
@@ -127,7 +127,7 @@ module Gapic
127
127
  end
128
128
 
129
129
  def env_prefix
130
- (gem_config(:env_prefix) || name.split("-").last).upcase
130
+ gem_config(:env_prefix)&.upcase
131
131
  end
132
132
 
133
133
  def iam_dependency?
@@ -156,18 +156,26 @@ module Gapic
156
156
  gem_config :issue_tracker_url
157
157
  end
158
158
 
159
+ ##
160
+ # @return [Boolean]
161
+ #
159
162
  def free_tier?
160
- # Default to false unless the config is explicitly set to "true"
161
- gem_config(:free_tier) == "true"
163
+ gem_config(:free_tier) || false
162
164
  end
163
165
 
166
+ ##
167
+ # @return [Boolean]
168
+ #
164
169
  def yard_strict?
165
170
  # Default to true unless the config is explicitly set to "false"
166
- gem_config(:yard_strict) != "false"
171
+ gem_config(:yard_strict).nil? || gem_config(:yard_strict)
167
172
  end
168
173
 
174
+ ##
175
+ # @return [Boolean]
176
+ #
169
177
  def generic_endpoint?
170
- gem_config(:generic_endpoint) == "true"
178
+ gem_config(:generic_endpoint) || false
171
179
  end
172
180
 
173
181
  def entrypoint_require
@@ -183,11 +191,13 @@ module Gapic
183
191
  end
184
192
 
185
193
  def dependencies
186
- deps = { "gapic-common" => "~> 0.4" }
187
- deps["grpc-google-iam-v1"] = [">= 0.6.10", "< 2.0"] if iam_dependency?
188
- extra_deps = gem_config :extra_dependencies
189
- deps.merge! extra_deps if extra_deps
190
- deps
194
+ @dependencies ||= begin
195
+ deps = { "gapic-common" => [">= 0.7", "< 2.a"] }
196
+ deps["grpc-google-iam-v1"] = [">= 0.6.10", "< 2.a"] if iam_dependency?
197
+ extra_deps = gem_config_dependencies
198
+ deps.merge! extra_deps if extra_deps
199
+ deps
200
+ end
191
201
  end
192
202
 
193
203
  def dependency_list
@@ -217,6 +227,29 @@ module Gapic
217
227
  JSON.pretty_generate first_package_drift_manifest
218
228
  end
219
229
 
230
+ ##
231
+ # The service to use for quick start samples. Normally this is simply the
232
+ # {#first_non_common_service}, but it can be overridden via a gem config.
233
+ #
234
+ # @return [Gapic::Presenters::ServicePresenter]
235
+ #
236
+ def quick_start_service
237
+ preferred_service = gem_config :quick_start_service
238
+ result = services.find { |svc| svc.name == preferred_service } if preferred_service
239
+ result || first_non_common_service
240
+ end
241
+
242
+ ##
243
+ # Whether the "Enabling (gRPC) Logging" section of the readme should
244
+ # appear. This is true if there is a quick-start service displayed in the
245
+ # readme, AND it uses gRPC.
246
+ #
247
+ # @return [Boolean]
248
+ #
249
+ def show_grpc_logging_docs?
250
+ packages? && quick_start_service.usable_service_presenter.is_a?(ServicePresenter)
251
+ end
252
+
220
253
  private
221
254
 
222
255
  def gem_config key
@@ -225,6 +258,26 @@ module Gapic
225
258
  @api.configuration[:gem][key]
226
259
  end
227
260
 
261
+ ##
262
+ # There is a special case (from PoV of generator parameters)
263
+ # in gem dependencies where a dependency needs to be an array of strings
264
+ # e.g. ">= 1.6", "< 2.a"
265
+ # Rather than creating a special generator param case for this I will special-case it here.
266
+ # '|' is the separator.
267
+ # The above would be represented as ">= 1.6|< 2.a"
268
+ #
269
+ # @return [Hash<String, String>, Hash{String=>Array<String>}, nil]
270
+ def gem_config_dependencies
271
+ return unless gem_config :extra_dependencies
272
+ gem_config(:extra_dependencies).map do |dep_name, dep_versions|
273
+ if dep_versions.include? "|"
274
+ [dep_name, dep_versions.split("|")]
275
+ else
276
+ [dep_name, dep_versions]
277
+ end
278
+ end.to_h
279
+ end
280
+
228
281
  def blacklist_protos
229
282
  blacklist = gem_config :blacklist
230
283
 
@@ -0,0 +1,246 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ module Gapic
18
+ module Presenters
19
+ module Method
20
+ ##
21
+ # Pagination info determined from the proto method
22
+ #
23
+ class RestPaginationInfo
24
+ include Gapic::Helpers::NamespaceHelper
25
+ ##
26
+ # @param proto_method [Gapic::Schema::Method] the method to derive pagination info from
27
+ # @param api [Gapic::Schema::Api]
28
+ #
29
+ def initialize proto_method, api
30
+ @api = api
31
+ @request = proto_method.input
32
+ @response = proto_method.output
33
+ @server_streaming = proto_method.server_streaming
34
+ end
35
+
36
+ ##
37
+ # Whether the method should be generated as paged
38
+ #
39
+ # @return [Boolean]
40
+ def paged?
41
+ !server_streaming? && paged_request? && paged_response?
42
+ end
43
+
44
+ ##
45
+ # Name of the request's field used for page size
46
+ # For Regapic can be either `page_size` or `max_results`
47
+ #
48
+ # @return [String, nil]
49
+ def request_page_size_name
50
+ request_page_size_field&.name
51
+ end
52
+
53
+ ##
54
+ # Name of the repeated field in the response message
55
+ # For REST gapics can be either a vanilla repeated field or a map
56
+ #
57
+ # @return [String, nil]
58
+ def response_repeated_field_name
59
+ response_results_field&.name
60
+ end
61
+
62
+ ##
63
+ # Whether the repeated field in the response message is a map
64
+ #
65
+ # @return [Boolean, nil]
66
+ def repeated_field_is_a_map?
67
+ response_results_field&.map?
68
+ end
69
+
70
+ ##
71
+ # Proto type of the repeated field in the response message
72
+ #
73
+ # @return [String, nil]
74
+ def paged_element_doc_type
75
+ return nil if response_results_field.nil?
76
+ field_paginated_elem_doc_type response_results_field
77
+ end
78
+
79
+ private
80
+
81
+ # Whether the underlying proto rpc is a server streaming rpc
82
+ # @return [Boolean]
83
+ attr_accessor :server_streaming
84
+
85
+ ##
86
+ # Whether the underlying proto rpc is a server streaming rpc
87
+ #
88
+ # @return [Boolean]
89
+ def server_streaming?
90
+ @server_streaming
91
+ end
92
+
93
+ ##
94
+ # Whether the request message for the REGAPIC rpc satisfies the criteria
95
+ # for the rpc to be classified and implemented as paged
96
+ #
97
+ # @return [Boolean]
98
+ def paged_request?
99
+ # Has a String page_token field which specifies the actual (next) page to retrieve.
100
+ # Has an int32 page_size or int32 max_results field
101
+ # which defines the maximum number of paginated resources to return in the response.
102
+ !request_page_token_field.nil? && !request_page_size_field.nil?
103
+ end
104
+
105
+ ##
106
+ # The field in the request that holds a page_token
107
+ #
108
+ # @return[Gapic::Schema::Field, nil]
109
+ def request_page_token_field
110
+ # Has a String page_token field which specifies the actual (next) page to retrieve.
111
+ @request_page_token_field ||= @request.fields.find do |f|
112
+ f.name == "page_token" && f.type == Google::Protobuf::FieldDescriptorProto::Type::TYPE_STRING
113
+ end
114
+ end
115
+
116
+ ##
117
+ # The field in the request that holds a page_size
118
+ # For Regapic can have a name of either `page_size` or `max_results`
119
+ #
120
+ # @return[Gapic::Schema::Field, nil]
121
+ def request_page_size_field
122
+ @request_page_size_field ||=
123
+ begin
124
+ page_size_names = ["page_size", "max_results"]
125
+
126
+ # Has the int32 page_size or int32 max_results field
127
+ # which defines the maximum number of paginated resources to return in the response.
128
+ page_size_types = [
129
+ Google::Protobuf::FieldDescriptorProto::Type::TYPE_UINT32,
130
+ Google::Protobuf::FieldDescriptorProto::Type::TYPE_INT32
131
+ ]
132
+
133
+ field = @request.fields.find do |f|
134
+ page_size_names.include?(f.name) && page_size_types.include?(f.type)
135
+ end
136
+
137
+ field
138
+ end
139
+ end
140
+
141
+ ##
142
+ # Whether the response message for the REGAPIC rpc satisfies the criteria
143
+ # for the rpc to be classified and implemented as paged
144
+ #
145
+ # @return [Boolean]
146
+ def paged_response?
147
+ # Has the string next_page_token field to be used in the next request as page_token to retrieve the next page.
148
+ # Has only one repeated or map<string, ?> field containing a list of paginated resources.
149
+ !response_next_page_token_field.nil? && !response_results_field.nil?
150
+ end
151
+
152
+ ##
153
+ # The field in the response that holds a next page_token
154
+ #
155
+ # @return[Gapic::Schema::Field, nil]
156
+ def response_next_page_token_field
157
+ # Has the string next_page_token field to be used in the next request as page_token to retrieve the next page.
158
+ @response_next_page_token_field ||= @response.fields.find do |f|
159
+ f.name == "next_page_token" && f.type == Google::Protobuf::FieldDescriptorProto::Type::TYPE_STRING
160
+ end
161
+ end
162
+
163
+ ##
164
+ # The field in the response that holds the results
165
+ # For Regapic can be either a vanilla repeated field or a map
166
+ #
167
+ # @return [Gapic::Schema::Field, nil]
168
+ def response_results_field
169
+ @response_results_field ||= begin
170
+ map_fields = @response.fields.find_all(&:map?)
171
+ repeated_fields = @response.fields.find_all do |f|
172
+ !f.map? &&
173
+ f.label == Google::Protobuf::FieldDescriptorProto::Label::LABEL_REPEATED
174
+ end
175
+
176
+ if map_fields.count == 1
177
+ # If the response message has only one map<string, ?> field
178
+ # treat it as the one with paginated resources (i.e. ignore the repeated fields if any).
179
+ map_fields.first
180
+ elsif repeated_fields.count == 1 && map_fields.empty?
181
+ # If the response message contains only one repeated field,
182
+ # treat that field as the one containing the paginated resources.
183
+ repeated_fields.first
184
+ end
185
+ # If the response message contains more than one repeated field or does not have repeated fields at all
186
+ # but has more than one map<string, ?> field, do not generate any paginated methods for such rpc.
187
+ end
188
+ end
189
+
190
+ ##
191
+ # A helper to get a Ruby doc-type for a paginated element.
192
+ #
193
+ # @param field [Gapic::Schema::Field]
194
+ #
195
+ # @return [String]
196
+ def field_paginated_elem_doc_type field
197
+ return field_paginated_elem_map_type field if field.map?
198
+ if field.message?
199
+ message_ruby_type field.message
200
+ elsif field.enum?
201
+ # TODO: handle when arg message is nil and enum is the type
202
+ message_ruby_type field.enum
203
+ else
204
+ case field.type
205
+ when 1, 2 then "::Float"
206
+ when 3, 4, 5, 6, 7, 13, 15, 16, 17, 18 then "::Integer"
207
+ when 9, 12 then "::String"
208
+ when 8 then "::Boolean"
209
+ else
210
+ "::Object"
211
+ end
212
+ end
213
+ end
214
+
215
+ ##
216
+ # A helper to get a Ruby doc-type for a proto map's paginated element.
217
+ #
218
+ # @param field [Gapic::Schema::Field]
219
+ #
220
+ # @return [String]
221
+ def field_paginated_elem_map_type field
222
+ key_field = field.map_key_field
223
+ value_field = field.map_val_field
224
+
225
+ if key_field && value_field
226
+ key_type = field_paginated_elem_doc_type key_field
227
+ value_type = field_paginated_elem_doc_type value_field
228
+ "#{key_type}, #{value_type}"
229
+ else
230
+ class_name
231
+ end
232
+ end
233
+
234
+ ##
235
+ # A helper to get a Ruby type for a proto message.
236
+ #
237
+ # @param message [Gapic::Schema::Message]
238
+ #
239
+ # @return [String]
240
+ def message_ruby_type message
241
+ ruby_namespace @api, message.address.join(".")
242
+ end
243
+ end
244
+ end
245
+ end
246
+ end