gapic-generator 0.11.0 → 0.45.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +299 -0
- data/CONTRIBUTING.md +1 -1
- data/README.md +71 -37
- data/bin/protoc-gen-ruby_gapic +2 -2
- data/lib/gapic/file_formatter.rb +23 -19
- data/lib/gapic/formatting_utils.rb +22 -9
- data/lib/gapic/gem_builder.rb +15 -17
- data/lib/gapic/generator/version.rb +1 -1
- data/lib/gapic/generators/base_generator.rb +6 -4
- data/lib/gapic/generators/default_generator.rb +70 -34
- data/lib/gapic/generators/default_generator_parameters.rb +9 -3
- data/lib/gapic/grpc_service_config/parser.rb +2 -2
- data/lib/gapic/model/api_metadata.rb +173 -0
- data/lib/gapic/model/method/http_annotation.rb +158 -60
- data/lib/gapic/model/method/lro.rb +8 -5
- data/lib/gapic/model/method/routing.rb +3 -18
- data/lib/gapic/model/mixins.rb +76 -10
- data/lib/gapic/model/service/nonstandard_lro_provider.rb +10 -11
- data/lib/gapic/package_snippets.rb +159 -0
- data/lib/gapic/path_pattern/parser.rb +11 -2
- data/lib/gapic/path_pattern/pattern.rb +18 -1
- data/lib/gapic/path_pattern/segment.rb +11 -4
- data/lib/gapic/presenters/enum_presenter.rb +14 -0
- data/lib/gapic/presenters/enum_value_presenter.rb +4 -1
- data/lib/gapic/presenters/field_presenter.rb +78 -21
- data/lib/gapic/presenters/gem_presenter.rb +109 -35
- data/lib/gapic/presenters/message_presenter.rb +15 -0
- data/lib/gapic/presenters/method/http_binding_presenter.rb +128 -0
- data/lib/gapic/presenters/method/rest_pagination_info.rb +25 -16
- data/lib/gapic/presenters/method_presenter.rb +109 -35
- data/lib/gapic/presenters/method_rest_presenter.rb +70 -137
- data/lib/gapic/presenters/package_presenter.rb +63 -18
- data/lib/gapic/presenters/resource_presenter.rb +9 -3
- data/lib/gapic/presenters/service/lro_client_presenter.rb +14 -14
- data/lib/gapic/presenters/service/mixin_client_presenter.rb +89 -0
- data/lib/gapic/presenters/service/sub_client_presenter.rb +84 -0
- data/lib/gapic/presenters/service_presenter.rb +183 -31
- data/lib/gapic/presenters/service_rest_presenter.rb +180 -27
- data/lib/gapic/presenters/snippet/client_call_presenter.rb +82 -0
- data/lib/gapic/presenters/snippet/client_initialization_presenter.rb +87 -0
- data/lib/gapic/presenters/snippet/declaration_presenter.rb +91 -0
- data/lib/gapic/presenters/snippet/expression_presenter.rb +135 -0
- data/lib/gapic/presenters/snippet/iteration_presenter.rb +118 -0
- data/lib/gapic/presenters/snippet/parameter_presenter.rb +67 -0
- data/lib/gapic/presenters/snippet/request_initialization_presenters.rb +202 -0
- data/lib/gapic/presenters/snippet/response_handling_presenters.rb +329 -0
- data/lib/gapic/presenters/snippet/statement_presenter.rb +134 -0
- data/lib/gapic/presenters/snippet/type_presenter.rb +98 -0
- data/lib/gapic/presenters/snippet_presenter.rb +199 -10
- data/lib/gapic/presenters.rb +2 -0
- data/lib/gapic/runner.rb +1 -1
- data/lib/gapic/schema/api.rb +49 -3
- data/lib/gapic/schema/loader.rb +67 -22
- data/lib/gapic/schema/parameter_schema.rb +8 -8
- data/lib/gapic/schema/proto_tools.rb +193 -0
- data/lib/gapic/schema/request_param_parser.rb +5 -7
- data/lib/gapic/schema/service_config_parser.rb +38 -4
- data/lib/gapic/schema/wrappers.rb +192 -31
- data/lib/gapic/uri_template/parser.rb +15 -7
- data/lib/google/cloud/tools/snippetgen/configlanguage/v1/snippet_config_language_pb.rb +104 -0
- data/lib/google/cloud/tools/snippetgen/snippetindex/v1/snippet_index_pb.rb +58 -0
- data/lib/google/protobuf/compiler/plugin_pb.rb +47 -0
- data/templates/default/binding_override.text.erb +6 -0
- data/templates/default/gem/gemfile.text.erb +12 -0
- data/templates/default/gem/{gemspec.erb → gemspec.text.erb} +3 -11
- data/templates/default/gem/{readme.erb → readme.text.erb} +10 -6
- data/templates/default/gem/{rubocop.erb → rubocop.text.erb} +3 -0
- data/templates/default/gem/{test_helper.erb → test_helper.text.erb} +4 -2
- data/templates/default/gem/toys.text.erb +12 -0
- data/templates/default/helpers/default_helper.rb +33 -1
- data/templates/default/lib/_binding_override.text.erb +49 -0
- data/templates/default/lib/{_package.erb → _package.text.erb} +6 -9
- data/templates/default/lib/_package_rest.text.erb +24 -0
- data/templates/default/lib/{_service.erb → _service.text.erb} +11 -23
- data/templates/default/lib/package/_self_configure.text.erb +16 -0
- data/templates/default/lib/package/_self_configure_defaults.text.erb +13 -0
- data/templates/default/lib/package/self_configure/_binding_default.text.erb +15 -0
- data/templates/default/lib/rest/_rest.text.erb +46 -0
- data/templates/default/package_rest.text.erb +6 -0
- data/templates/default/proto_docs/_deprecated.text.erb +9 -0
- data/templates/default/proto_docs/{_enum.erb → _enum.text.erb} +1 -0
- data/templates/default/proto_docs/{_message.erb → _message.text.erb} +2 -0
- data/templates/default/service/client/{_client.erb → _client.text.erb} +60 -12
- data/templates/default/service/client/{_config.erb → _config.text.erb} +39 -8
- data/templates/default/service/client/{_operations.erb → _operations.text.erb} +24 -3
- data/templates/default/service/client/method/{_def.erb → _def.text.erb} +2 -2
- data/templates/default/service/client/method/def/{_options_defaults.erb → _options_defaults.text.erb} +2 -1
- data/templates/default/service/client/method/def/_request_normal.text.erb +18 -0
- data/templates/default/service/client/method/def/_request_streaming.text.erb +23 -0
- data/templates/default/service/client/method/def/{_response.erb → _response.text.erb} +2 -0
- data/templates/default/service/client/method/def/{_response_nonstandard_lro.erb → _response_nonstandard_lro.text.erb} +1 -1
- data/templates/default/service/client/method/def/_response_normal.text.erb +4 -0
- data/templates/default/service/client/method/def/{_response_normal.erb → _response_normal_lro.text.erb} +1 -3
- data/templates/default/service/client/method/def/{_response_paged.erb → _response_paged.text.erb} +1 -1
- data/templates/default/service/client/method/docs/{_request_normal.erb → _request_normal.text.erb} +1 -1
- data/templates/default/service/client/method/docs/_snippets.text.erb +6 -0
- data/templates/default/service/client/resource/_def.text.erb +7 -0
- data/templates/default/service/nonstandard_lro.text.erb +6 -0
- data/templates/default/service/rest/client/{_client.erb → _client.text.erb} +82 -13
- data/templates/default/service/rest/client/_config.text.erb +178 -0
- data/templates/default/service/rest/client/_operations.text.erb +124 -0
- data/templates/default/service/rest/client/method/{_def.erb → _def.text.erb} +7 -1
- data/templates/default/service/rest/client/method/def/{_options_defaults.erb → _options_defaults.text.erb} +8 -3
- data/templates/default/service/rest/client/method/def/{_response.erb → _response.text.erb} +4 -0
- data/templates/default/service/rest/client/method/def/{_response_nonstandard_lro.erb → _response_nonstandard_lro.text.erb} +5 -4
- data/templates/default/service/rest/client/method/def/_response_normal.text.erb +5 -0
- data/templates/default/service/rest/client/method/def/_response_normal_lro.text.erb +7 -0
- data/templates/default/service/rest/client/method/def/_response_paged.text.erb +7 -0
- data/templates/default/service/rest/client/method/def/_response_server_streaming.text.erb +11 -0
- data/templates/default/service/rest/client/method/docs/{_request.erb → _request.text.erb} +1 -3
- data/templates/default/service/rest/client/method/docs/_result.text.erb +10 -0
- data/templates/default/service/rest/client/method/docs/_snippets.text.erb +6 -0
- data/templates/default/service/{nonstandard_lro.erb → rest/nonstandard_lro.text.erb} +1 -1
- data/templates/default/service/rest/operations.text.erb +6 -0
- data/templates/default/service/rest/service_stub/_service_stub.text.erb +63 -0
- data/templates/default/service/rest/service_stub/grpc_transcoding_method/_def.text.erb +37 -0
- data/templates/default/service/rest/service_stub/method/_def.text.erb +35 -0
- data/templates/default/service/rest/service_stub/method/def/_response.text.erb +37 -0
- data/templates/default/service/rest/test/{client.erb → client.text.erb} +3 -3
- data/templates/default/service/rest/test/method/_assert_response.text.erb +2 -0
- data/templates/default/service/rest/test/method/{_configure.erb → _configure.text.erb} +3 -2
- data/templates/default/service/rest/test/method/_normal.text.erb +60 -0
- data/templates/default/service/rest/test/method/_server.text.erb +60 -0
- data/templates/default/service/rest/test/method/{_setup.erb → _setup.text.erb} +26 -10
- data/templates/default/service/test/{_resource.erb → _resource.text.erb} +1 -1
- data/templates/default/service/test/{client.erb → client.text.erb} +3 -2
- data/templates/default/service/test/client_paths.text.erb +33 -0
- data/templates/default/service/test/method/{_bidi.erb → _bidi.text.erb} +1 -1
- data/templates/default/service/test/method/{_client.erb → _client.text.erb} +1 -1
- data/templates/default/service/test/method/{_configure.erb → _configure.text.erb} +2 -1
- data/templates/default/service/test/method/{_normal.erb → _normal.text.erb} +1 -1
- data/templates/default/service/test/method/{_server.erb → _server.text.erb} +1 -1
- data/templates/default/service/test/method/{_setup.erb → _setup.text.erb} +19 -2
- data/templates/default/snippets/{gemfile.erb → gemfile.text.erb} +2 -2
- data/templates/default/snippets/snippet/_body.text.erb +24 -0
- data/templates/default/snippets/snippet/_inline.text.erb +11 -0
- data/templates/default/snippets/snippet/_standalone.text.erb +25 -0
- data/templates/default/snippets/{standalone.erb → standalone.text.erb} +1 -1
- metadata +198 -273
- data/lib/google/api/annotations.pb.rb +0 -39
- data/lib/google/api/auth.pb.rb +0 -75
- data/lib/google/api/backend.pb.rb +0 -59
- data/lib/google/api/billing.pb.rb +0 -53
- data/lib/google/api/client.pb.rb +0 -43
- data/lib/google/api/context.pb.rb +0 -47
- data/lib/google/api/control.pb.rb +0 -38
- data/lib/google/api/documentation.pb.rb +0 -56
- data/lib/google/api/endpoint.pb.rb +0 -42
- data/lib/google/api/field_behavior.pb.rb +0 -51
- data/lib/google/api/http.pb.rb +0 -60
- data/lib/google/api/label.pb.rb +0 -49
- data/lib/google/api/launch_stage.pb.rb +0 -37
- data/lib/google/api/log.pb.rb +0 -47
- data/lib/google/api/logging.pb.rb +0 -48
- data/lib/google/api/metric.pb.rb +0 -90
- data/lib/google/api/monitored_resource.pb.rb +0 -68
- data/lib/google/api/monitoring.pb.rb +0 -48
- data/lib/google/api/quota.pb.rb +0 -63
- data/lib/google/api/resource.pb.rb +0 -80
- data/lib/google/api/routing.pb.rb +0 -58
- data/lib/google/api/service.pb.rb +0 -90
- data/lib/google/api/source_info.pb.rb +0 -44
- data/lib/google/api/system_parameter.pb.rb +0 -51
- data/lib/google/api/usage.pb.rb +0 -47
- data/lib/google/cloud/extended_operations.pb.rb +0 -57
- data/lib/google/longrunning/operations.pb.rb +0 -115
- data/lib/google/protobuf/any.pb.rb +0 -40
- data/lib/google/protobuf/api.pb.rb +0 -69
- data/lib/google/protobuf/compiler/plugin.pb.rb +0 -79
- data/lib/google/protobuf/descriptor.pb.rb +0 -360
- data/lib/google/protobuf/duration.pb.rb +0 -41
- data/lib/google/protobuf/empty.pb.rb +0 -36
- data/lib/google/protobuf/source_context.pb.rb +0 -39
- data/lib/google/protobuf/struct.pb.rb +0 -65
- data/lib/google/protobuf/type.pb.rb +0 -128
- data/lib/google/protobuf/wrappers.pb.rb +0 -80
- data/lib/google/rpc/status.pb.rb +0 -46
- data/templates/default/gem/gemfile.erb +0 -4
- data/templates/default/lib/rest/_rest.erb +0 -9
- data/templates/default/service/client/method/def/_request_normal.erb +0 -4
- data/templates/default/service/client/method/def/_request_streaming.erb +0 -9
- data/templates/default/service/client/method/docs/_deprecated.erb +0 -5
- data/templates/default/service/client/method/docs/_snippets.erb +0 -6
- data/templates/default/service/client/resource/_def.erb +0 -6
- data/templates/default/service/rest/client/_config.erb +0 -122
- data/templates/default/service/rest/client/method/def/_response_normal.erb +0 -6
- data/templates/default/service/rest/client/method/def/_response_paged.erb +0 -7
- data/templates/default/service/rest/client/method/docs/_result.erb +0 -6
- data/templates/default/service/rest/service_stub/_service_stub.erb +0 -25
- data/templates/default/service/rest/service_stub/grpc_transcoding_method/_def.erb +0 -24
- data/templates/default/service/rest/service_stub/method/_def.erb +0 -20
- data/templates/default/service/rest/service_stub/method/def/_response.erb +0 -17
- data/templates/default/service/rest/test/method/_assert_response.erb +0 -2
- data/templates/default/service/rest/test/method/_normal.erb +0 -71
- data/templates/default/service/test/client_paths.erb +0 -15
- data/templates/default/snippets/snippet/_structure.erb +0 -71
- /data/gem_templates/{binary.erb → binary.text.erb} +0 -0
- /data/gem_templates/{dockerfile.erb → dockerfile.text.erb} +0 -0
- /data/gem_templates/{entrypoint.erb → entrypoint.text.erb} +0 -0
- /data/gem_templates/{gapic_sh.erb → gapic_sh.text.erb} +0 -0
- /data/gem_templates/{gemfile.erb → gemfile.text.erb} +0 -0
- /data/gem_templates/{gemspec.erb → gemspec.text.erb} +0 -0
- /data/gem_templates/{generator.erb → generator.text.erb} +0 -0
- /data/gem_templates/{gitignore.erb → gitignore.text.erb} +0 -0
- /data/gem_templates/{rakefile.erb → rakefile.text.erb} +0 -0
- /data/gem_templates/{readme.erb → readme.text.erb} +0 -0
- /data/gem_templates/{rubocop.erb → rubocop.text.erb} +0 -0
- /data/gem_templates/shared/{_header.erb → _header.text.erb} +0 -0
- /data/gem_templates/shared/{_license.erb → _license.text.erb} +0 -0
- /data/gem_templates/shared/{_warning.erb → _warning.text.erb} +0 -0
- /data/gem_templates/{test_generator.erb → test_generator.text.erb} +0 -0
- /data/gem_templates/{test_helper.erb → test_helper.text.erb} +0 -0
- /data/gem_templates/{version.erb → version.text.erb} +0 -0
- /data/templates/default/gem/{_version.erb → _version.text.erb} +0 -0
- /data/templates/default/gem/{changelog.erb → changelog.text.erb} +0 -0
- /data/templates/default/gem/{entrypoint.erb → entrypoint.text.erb} +0 -0
- /data/templates/default/gem/{gapic_metadata_json.erb → gapic_metadata_json.text.erb} +0 -0
- /data/templates/default/gem/{gitignore.erb → gitignore.text.erb} +0 -0
- /data/templates/default/gem/{license.erb → license.text.erb} +0 -0
- /data/templates/default/gem/{rakefile.erb → rakefile.text.erb} +0 -0
- /data/templates/default/gem/{version.erb → version.text.erb} +0 -0
- /data/templates/default/gem/{yardopts.erb → yardopts.text.erb} +0 -0
- /data/templates/default/layouts/{_ruby.erb → _ruby.text.erb} +0 -0
- /data/templates/default/{package.erb → package.text.erb} +0 -0
- /data/templates/default/proto_docs/{_proto_file.erb → _proto_file.text.erb} +0 -0
- /data/templates/default/proto_docs/{proto_file.erb → proto_file.text.erb} +0 -0
- /data/templates/default/proto_docs/{readme.erb → readme.text.erb} +0 -0
- /data/templates/default/service/{_helpers.erb → _helpers.text.erb} +0 -0
- /data/templates/default/service/client/{_credentials.erb → _credentials.text.erb} +0 -0
- /data/templates/default/service/client/{_nonstandard_lro.erb → _nonstandard_lro.text.erb} +0 -0
- /data/templates/default/service/client/{_paths.erb → _paths.text.erb} +0 -0
- /data/templates/default/service/client/{_requires.erb → _requires.text.erb} +0 -0
- /data/templates/default/service/client/{_resource.erb → _resource.text.erb} +0 -0
- /data/templates/default/service/client/{_self_configure.erb → _self_configure.text.erb} +0 -0
- /data/templates/default/service/client/{_self_configure_defaults.erb → _self_configure_defaults.text.erb} +0 -0
- /data/templates/default/service/client/method/def/{_request.erb → _request.text.erb} +0 -0
- /data/templates/default/service/client/method/def/{_rescue.erb → _rescue.text.erb} +0 -0
- /data/templates/default/service/client/method/def/{_routing_params.erb → _routing_params.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/{_error.erb → _error.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/{_request.erb → _request.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/{_request_field.erb → _request_field.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/{_request_streaming.erb → _request_streaming.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/{_response.erb → _response.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/{_sample.erb → _sample.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/{_sample_response.erb → _sample_response.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/{_samples.erb → _samples.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/request_field/{_arg.erb → _arg.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/request_field/{_hash.erb → _hash.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/sample_response/{_comment.erb → _comment.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/sample_response/{_define.erb → _define.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/sample_response/{_loop.erb → _loop.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/sample_response/{_print.erb → _print.text.erb} +0 -0
- /data/templates/default/service/client/method/docs/sample_response/{_write_file.erb → _write_file.text.erb} +0 -0
- /data/templates/default/service/client/resource/{_doc.erb → _doc.text.erb} +0 -0
- /data/templates/default/service/client/resource/{_multi.erb → _multi.text.erb} +0 -0
- /data/templates/default/service/client/resource/{_single.erb → _single.text.erb} +0 -0
- /data/templates/default/service/{client.erb → client.text.erb} +0 -0
- /data/templates/default/service/{credentials.erb → credentials.text.erb} +0 -0
- /data/templates/default/service/{operations.erb → operations.text.erb} +0 -0
- /data/templates/default/service/{paths.erb → paths.text.erb} +0 -0
- /data/templates/default/service/rest/client/method/def/{_rescue.erb → _rescue.text.erb} +0 -0
- /data/templates/default/service/rest/client/method/docs/{_error.erb → _error.text.erb} +0 -0
- /data/templates/default/service/rest/{client.erb → client.text.erb} +0 -0
- /data/templates/default/service/rest/{grpc_transcoding.erb → grpc_transcoding.text.erb} +0 -0
- /data/templates/default/service/rest/service_stub/grpc_transcoding_method/def/{_query_string_param.erb → _query_string_param.text.erb} +0 -0
- /data/templates/default/service/rest/service_stub/method/def/{_request.erb → _request.text.erb} +0 -0
- /data/templates/default/service/rest/{service_stub.erb → service_stub.text.erb} +0 -0
- /data/templates/default/service/{rest.erb → rest.text.erb} +0 -0
- /data/templates/default/service/test/{client_operations.erb → client_operations.text.erb} +0 -0
- /data/templates/default/service/test/method/{_assert_response.erb → _assert_response.text.erb} +0 -0
- /data/templates/default/service/test/{smoke.erb → smoke.text.erb} +0 -0
- /data/templates/default/{service.erb → service.text.erb} +0 -0
- /data/templates/default/shared/{_header.erb → _header.text.erb} +0 -0
- /data/templates/default/shared/{_license.erb → _license.text.erb} +0 -0
- /data/templates/default/shared/{_warning.erb → _warning.text.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c44ace94e73e85dad3b7b20373016a28f46181631709dd52fe19672b7da80a6
|
4
|
+
data.tar.gz: 2f8bdc5d63b8253687711ff7bc6d139e536cc3f5d096be9c8f1546676db60aa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f24b95f72f3a26e89190694fff115e8b6e5206b430676fda14ef6d3669b6b2de1eefdada75d2420607f63d31789491acfb11f419cbdce237deaa1fa597fb667
|
7
|
+
data.tar.gz: b88884b59cc8d3d426f793a97696617e2314b81c4c38e61fa3a507270a2d9e20e67c631fdefad2cf2cd793f5c1bae06577dd4381157a33b64092ad7c7f77ee97
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,304 @@
|
|
1
1
|
# Release History for gapic-generator
|
2
2
|
|
3
|
+
### 0.45.1 / 2025-05-01
|
4
|
+
|
5
|
+
No significant changes
|
6
|
+
|
7
|
+
### 0.45.0 / 2025-05-01
|
8
|
+
|
9
|
+
* Feature: Updated rails to 8.0
|
10
|
+
* Feature: Update protobuf to 4.30
|
11
|
+
* Feature: Update common dependencies for generated clients
|
12
|
+
* Fix: update Ruby prebuilt binary, version 3.4.3
|
13
|
+
|
14
|
+
### 0.44.0 / 2025-04-30
|
15
|
+
|
16
|
+
* Feature: Update Ruby for the generator to 3.2.8 including prebuilt binary
|
17
|
+
* Feature: Set minumum Ruby version for generated code to 3.1 and use google-style 1.31
|
18
|
+
|
19
|
+
### 0.43.0 / 2025-04-24
|
20
|
+
|
21
|
+
* Fix: Fixed typo in generated wrapper readmes
|
22
|
+
* Fix: Provide a better check for grpc when typechecking credentials
|
23
|
+
* Feature: bless "::Google::Auth::BaseClient" as an allowed by default credentials type in Config
|
24
|
+
|
25
|
+
### 0.42.1 / 2025-02-04
|
26
|
+
|
27
|
+
* Fix: Wrappers load release dependencies if local dependencies do not match
|
28
|
+
|
29
|
+
### 0.42.0 / 2025-01-30
|
30
|
+
|
31
|
+
* Feature: Change REGAPIC pagination algorithm to the standard algorithm for non-compute clients
|
32
|
+
|
33
|
+
### 0.41.0 / 2025-01-24
|
34
|
+
|
35
|
+
* Feature: Change minimum Ruby version to 3.0
|
36
|
+
|
37
|
+
### 0.40.0 / 2025-01-24
|
38
|
+
|
39
|
+
No significant changes
|
40
|
+
|
41
|
+
### 0.39.2 / 2025-01-24
|
42
|
+
|
43
|
+
* Fix: Add warning regarding external credential sourcing
|
44
|
+
|
45
|
+
### 0.39.1 / 2025-01-23
|
46
|
+
|
47
|
+
* Fix: Updated minimum gapic-common version to 0.25
|
48
|
+
|
49
|
+
### 0.39.0 / 2025-01-22
|
50
|
+
|
51
|
+
* Feature: Add clarifying notes to oneof members in proto_docs
|
52
|
+
|
53
|
+
### 0.38.3 / 2024-12-10
|
54
|
+
|
55
|
+
* Fix: Added logger methods to generated dummy stub classes in generated tests
|
56
|
+
|
57
|
+
### 0.38.2 / 2024-12-10
|
58
|
+
|
59
|
+
* Fix: Throw the correct result object for REST with nonstandard LRO
|
60
|
+
|
61
|
+
### 0.38.1 / 2024-12-09
|
62
|
+
|
63
|
+
* Fix: fix wrapper gem tests by stubbing the stub_logger method
|
64
|
+
|
65
|
+
### 0.38.0 / 2024-12-06
|
66
|
+
|
67
|
+
* Feature: Support request-response debug logging from generated GAPICs
|
68
|
+
|
69
|
+
### 0.37.0 / 2024-10-24
|
70
|
+
|
71
|
+
* Feature: Remove path tests for clients using REST without gRPC
|
72
|
+
|
73
|
+
### 0.36.1 / 2024-09-20
|
74
|
+
|
75
|
+
* Fix: Add missing local binding in resource path methods
|
76
|
+
|
77
|
+
### 0.36.0 / 2024-08-22
|
78
|
+
|
79
|
+
* Feature: Support local binding for variables with keyword collision
|
80
|
+
|
81
|
+
### 0.35.0 / 2024-08-15
|
82
|
+
|
83
|
+
* Feature: Disable xrefs for README files in wrapper gems
|
84
|
+
|
85
|
+
### 0.34.1 / 2024-08-08
|
86
|
+
|
87
|
+
No significant changes
|
88
|
+
|
89
|
+
### 0.34.0 / 2024-08-07
|
90
|
+
|
91
|
+
* Feature: Resolve keyword conflicts with path pattern variable names
|
92
|
+
* Feature: Prevent keyword collision with field names as values
|
93
|
+
* Feature: Refactor README.md and gemspec files
|
94
|
+
|
95
|
+
### 0.33.0 / 2024-07-02
|
96
|
+
|
97
|
+
* Fix: Resolve BigDecimal warning
|
98
|
+
* Feature: Format path pattern variables to snake case
|
99
|
+
|
100
|
+
### 0.32.0 / 2024-05-13
|
101
|
+
|
102
|
+
* Feature: Introduce google.api.api_version option to generated clients
|
103
|
+
|
104
|
+
### 0.31.0 / 2024-04-25
|
105
|
+
|
106
|
+
* Feature: Remove api-common-protos dependency
|
107
|
+
* Feature: Use module name to prevent keyword collision with enum values
|
108
|
+
|
109
|
+
### 0.30.0 / 2024-04-24
|
110
|
+
|
111
|
+
* Feature: support auto populating request fields with explicit presence
|
112
|
+
* Feature: avoid keyword collision for enum value names
|
113
|
+
* Fix: Start requiring ostruct in generated test helper files
|
114
|
+
|
115
|
+
### 0.29.0 / 2024-02-22
|
116
|
+
|
117
|
+
* Feature: Update minimum Ruby version of generated libraries to 2.7
|
118
|
+
* Fix: update gemfiles and set bundle platforms to x86_64-linux
|
119
|
+
|
120
|
+
### 0.28.0 / 2024-02-14
|
121
|
+
|
122
|
+
* Feature: introduce auto_populated_fields (uuid4) to generator
|
123
|
+
|
124
|
+
### 0.27.4 / 2024-01-12
|
125
|
+
|
126
|
+
No significant changes
|
127
|
+
|
128
|
+
### 0.27.3 / 2024-01-12
|
129
|
+
|
130
|
+
* Fix: Ensure the correct endpoint gets to mixin clients
|
131
|
+
|
132
|
+
### 0.27.2 / 2024-01-11
|
133
|
+
|
134
|
+
No significant changes
|
135
|
+
|
136
|
+
### 0.27.1 / 2024-01-09
|
137
|
+
|
138
|
+
* Fix: Update mixin dependencies to versions that support universe domain
|
139
|
+
|
140
|
+
### 0.27.0 / 2024-01-08
|
141
|
+
|
142
|
+
* Feature: update generated samples docs
|
143
|
+
* Feature: Update rubocop autofix to use Rubocop 1.59
|
144
|
+
* Feature: add @deprecated tags to document items
|
145
|
+
* Feature: Generate toys files
|
146
|
+
* Feature: Support universe domain in GAPIC
|
147
|
+
|
148
|
+
### 0.26.0 / 2023-12-04
|
149
|
+
|
150
|
+
* Feature: Use google-protobuf instead of third-party protobuf library
|
151
|
+
* Fix: clean up and update gem dependencies
|
152
|
+
|
153
|
+
### 0.25.1 / 2023-09-12
|
154
|
+
|
155
|
+
* Fix: Workaround for grpc windows issue during tests
|
156
|
+
|
157
|
+
### 0.25.0 / 2023-09-07
|
158
|
+
|
159
|
+
* Feature: Add support for channel pool in gapic generator
|
160
|
+
* Fix: Fix snippet generation for REGAPIC clients
|
161
|
+
|
162
|
+
### 0.24.0 / 2023-07-05
|
163
|
+
|
164
|
+
* Feature: Loosen parsing for extra_dependencies
|
165
|
+
|
166
|
+
### 0.23.4 / 2023-06-03
|
167
|
+
|
168
|
+
* Fix: Updates to the bundle locks
|
169
|
+
* Fix: Generated clients depend on gapic-common 0.19.1
|
170
|
+
* Fix: Fixes the enable_self_signed_jwt determination when the endpoint in the global configuration object (as opposed to the constructor configuration block) is modified
|
171
|
+
|
172
|
+
### 0.23.3 / 2023-05-26
|
173
|
+
|
174
|
+
* Fix: Generated clients depend on gapic-common 0.19
|
175
|
+
|
176
|
+
### 0.23.2 / 2023-03-08
|
177
|
+
|
178
|
+
* Fix: Remove html tags from description text parsed from service yaml
|
179
|
+
* Fix: Fail generation if Rubocop autoformatting fails
|
180
|
+
* Fix: Replace googleapis.dev links with equivalent cloud.google.com or rubydoc.info links
|
181
|
+
* Fix: Fix special case iam API shortname
|
182
|
+
|
183
|
+
### 0.23.1 / 2023-02-28
|
184
|
+
|
185
|
+
* Fix: update gapic-common version
|
186
|
+
* Fix: Handle empty fields in service yaml
|
187
|
+
|
188
|
+
### 0.23.0 / 2023-02-27
|
189
|
+
|
190
|
+
* Feature: Honor metadata from the service yaml
|
191
|
+
|
192
|
+
### 0.22.0 / 2023-02-14
|
193
|
+
|
194
|
+
* Feature: Update mixin dependency versions to 0.4
|
195
|
+
|
196
|
+
### 0.21.1 / 2023-02-13
|
197
|
+
|
198
|
+
* Fix: Get rubocop working in bazel
|
199
|
+
|
200
|
+
### 0.21.0 / 2023-02-09
|
201
|
+
|
202
|
+
* Feature: Load and interpret snippetgen phase 2 config data
|
203
|
+
* Feature: Added SnippetGen phase2 implementation
|
204
|
+
* Feature: Reimplemented snippetgen phase 1 using phase 2
|
205
|
+
* Feature: Implemented enough of SnippetGen phase 2 to generate the initial test case
|
206
|
+
* Feature: add a transport operation class in Rest
|
207
|
+
* Fix: yield TransportOperation class instead of Faraday's
|
208
|
+
|
209
|
+
### 0.20.0 / 2023-01-19
|
210
|
+
|
211
|
+
* Feature: migrate generator bazel (including prebuilts) to 3.1.3
|
212
|
+
|
213
|
+
### 0.19.0 / 2023-01-17
|
214
|
+
|
215
|
+
* Fix: fail on rest transport and no bindings
|
216
|
+
* Feature: Bump mixin minimum version to 0.3
|
217
|
+
|
218
|
+
### 0.18.1 / 2022-12-15
|
219
|
+
|
220
|
+
* Fix: Don't generate bindings_override.rb unless REST transport is active
|
221
|
+
|
222
|
+
### 0.18.0 / 2022-12-15
|
223
|
+
|
224
|
+
* Feature: add quota project and misc to REGAPIC templates
|
225
|
+
* Feature: use retry policy in regapic templates
|
226
|
+
* Fix: avoid creating rest default configuration for non-rest methods
|
227
|
+
* Fix: transcoding in regapic tests
|
228
|
+
* Fix: Cross-ref links use the REST client class in REST client docs
|
229
|
+
* Feature: implements template changes for REST server-streaming.
|
230
|
+
* Feature: all fixes for the combined rest+grpc libraries
|
231
|
+
* Feature: generate bindings override for REST mixins
|
232
|
+
* Fix: handle only regapic errors for REST libraries
|
233
|
+
* Feature: Recognize transport argument for bazel jobs
|
234
|
+
* Feature: Updated wrapper generator to support multi-transport clients
|
235
|
+
|
236
|
+
### 0.17.2 / 2022-10-27
|
237
|
+
|
238
|
+
* Fix: Update snippetgen phase 1 to conform to standard sample style
|
239
|
+
|
240
|
+
### 0.17.1 / 2022-10-26
|
241
|
+
|
242
|
+
* Fix: Fixed typo in rest_numeric_enums bazel field handling
|
243
|
+
|
244
|
+
### 0.17.0 / 2022-10-21
|
245
|
+
|
246
|
+
* Feature: Recognize rest_numeric_enums argument for bazel jobs
|
247
|
+
|
248
|
+
### 0.16.1 / 2022-09-27
|
249
|
+
|
250
|
+
No significant changes
|
251
|
+
|
252
|
+
### 0.16.0 / 2022-09-16
|
253
|
+
|
254
|
+
* Feature: Support numeric enums
|
255
|
+
|
256
|
+
### 0.15.3 / 2022-08-18
|
257
|
+
|
258
|
+
* Fix: Fix out of date SDK auth documentation
|
259
|
+
|
260
|
+
### 0.15.2 / 2022-07-27
|
261
|
+
|
262
|
+
* Fix: only do service config http binding override on Operations
|
263
|
+
* Fix: Apply both namespace and service overrides to service names in yard links
|
264
|
+
|
265
|
+
### 0.15.1 / 2022-07-26
|
266
|
+
|
267
|
+
* Fix: mixin proto_docs removal works for iam
|
268
|
+
|
269
|
+
### 0.15.0 / 2022-07-25
|
270
|
+
|
271
|
+
* Feature: classic (AIP-151) LROs in REST
|
272
|
+
* Feature: grpc transcoding with `additional_bindings`
|
273
|
+
* Fix: Honor service overrides in yard cross-references
|
274
|
+
* Fix: suppress generation of mixin proto_docs and wrapper client factory methods
|
275
|
+
|
276
|
+
### 0.14.1 / 2022-06-29
|
277
|
+
|
278
|
+
* Fix: fix crash when generating generic endpoints
|
279
|
+
|
280
|
+
### 0.14.0 / 2022-06-27
|
281
|
+
|
282
|
+
* Feature: generate code using full GRPC transcoding for rest libraries
|
283
|
+
* Feature: generating libraries with rest and grpc transports
|
284
|
+
* Fix: LRO-wrapped methods of the internal Operations client not working
|
285
|
+
* Feature: Update minimum Ruby version to 2.6
|
286
|
+
|
287
|
+
### 0.13.0 / 2022-05-11
|
288
|
+
|
289
|
+
* Feature: Adjust links and repo metadata based on whether the product is part of gcp/cloud
|
290
|
+
* Fix: Loosen mixin dependencies to allow 1.x versions
|
291
|
+
* Fix: Disable generation of services that are handled as mixins
|
292
|
+
* Fix: Disable mixin generation when common services are configured
|
293
|
+
|
294
|
+
### 0.12.0 / 2022-04-29
|
295
|
+
|
296
|
+
* Feature: Generate snippet metadata files
|
297
|
+
|
298
|
+
### 0.11.1 / 2022-04-06
|
299
|
+
|
300
|
+
* Updated generated grpc-google-iam-v1 dependency to ~> 1.1
|
301
|
+
|
3
302
|
### 0.11.0 / 2022-03-01
|
4
303
|
|
5
304
|
* New: Added generation of nonstandard LRO wrapper calls (currently used for Compute)
|
data/CONTRIBUTING.md
CHANGED
@@ -11,7 +11,7 @@ this simply gives us permission to use and redistribute your contributions as
|
|
11
11
|
part of the project. Head over to <https://cla.developers.google.com/> to see
|
12
12
|
your current agreements on file or to sign a new one.
|
13
13
|
|
14
|
-
You generally
|
14
|
+
You generally need to submit a CLA only once, so if you've already submitted one
|
15
15
|
(even if it was for a different project), you probably don't need to do it
|
16
16
|
again.
|
17
17
|
|
data/README.md
CHANGED
@@ -2,24 +2,59 @@
|
|
2
2
|
|
3
3
|
Create Ruby clients from a protocol buffer description of an API.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
This code is used to generate client libraries for many Google APIs including
|
6
|
+
Cloud and Ads services. The `gapic-generator` gem itself includes the main
|
7
|
+
generator, whereas the `gapic-generator-cloud` and `gapic-generator-ads` gems
|
8
|
+
provide modifications specific to Google Cloud and Google Ads APIs.
|
9
|
+
|
10
|
+
These gems can also be used to create clients for any other API, for Google or
|
11
|
+
non-Google services, that use protocol buffers as the description language. The
|
12
|
+
generators will work best for APIs that follow the design guidance documented
|
13
|
+
in the [Google AIPs](https://aip.dev/). An API that is not AIP-compliant should
|
14
|
+
still yield a usable client library, but it may be missing features such as
|
15
|
+
idiomatic naming, pagination, or retry configuration.
|
16
|
+
|
17
|
+
**Important:** This is not an official Google project. While it is being used
|
18
|
+
internally to generate official Google API client libraries, there is no
|
19
|
+
guarantee of support or stability for any other use.
|
20
|
+
|
21
|
+
## Using the Ruby gem
|
22
|
+
|
23
|
+
This section provides a brief getting started guide for the Ruby gem. However,
|
24
|
+
we do not release the Ruby gems often, and they may be substantially behind the
|
25
|
+
current generator code. In most cases, we recommend generating from the
|
26
|
+
GitHub repository directly. See the main README for
|
27
|
+
https://github.com/googleapis/gapic-generator-ruby for more information.
|
9
28
|
|
10
29
|
### Install the Generator
|
11
30
|
|
12
|
-
|
31
|
+
The generator is a plugin for **protoc**, the protocol buffers compiler, so
|
32
|
+
you'll need to install it first, along with the standard protobuf and grpc
|
33
|
+
plugins for Ruby. The easiest way to do this is to install the `grpc-tools` gem
|
34
|
+
which will provide all three. You can also follow the
|
35
|
+
[official install instructions](https://github.com/protocolbuffers/protobuf#protobuf-compiler-installation).
|
36
|
+
Note that if you installed protoc using `grpc-tools`, the compiler binary name
|
37
|
+
will be named `grpc_tools_ruby_protoc`; otherwise it will likely be `protoc`.
|
38
|
+
|
39
|
+
Install the `gapic-generator` gem to get access to the gapic generator plugin.
|
40
|
+
|
41
|
+
Optionally install either `gapic-generator-cloud` or `gapic-generator-ads` if
|
42
|
+
you want access to cloud-specific or ads-specific output.
|
43
|
+
|
44
|
+
Alternatively, add all the above to a Gemfile:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
# Gemfile
|
48
|
+
source "https://rubygems.org/"
|
49
|
+
|
50
|
+
gem "grpc-tools"
|
51
|
+
gem "gapic-generator"
|
52
|
+
```
|
53
|
+
|
54
|
+
And install using bundler:
|
13
55
|
|
14
56
|
```sh
|
15
|
-
$ git clone https://github.com/googleapis/gapic-generator-ruby.git
|
16
|
-
$ cd gapic-generator-ruby
|
17
|
-
$ git submodule update --init
|
18
|
-
$ cd gapic-generator
|
19
57
|
$ bundle install
|
20
|
-
$ bundle exec rake install
|
21
|
-
$ which protoc-gen-ruby_gapic
|
22
|
-
> {Non-empty path}
|
23
58
|
```
|
24
59
|
|
25
60
|
### Generate an API
|
@@ -28,45 +63,44 @@ Installing this generator exposes `protoc-gen-ruby_gapic` on the PATH. By doing
|
|
28
63
|
so, it gives the protobuf compiler the CLI option `--ruby_gapic_out` on which
|
29
64
|
you can specify an output path for this generator.
|
30
65
|
|
31
|
-
|
66
|
+
In most cases, in order to generate a functional client library, you must also
|
67
|
+
include the Ruby proto and grpc plugins, using the CLI options `--ruby_out` and
|
68
|
+
`--grpc_out`.
|
69
|
+
|
70
|
+
If you want to experiment with an already-existing API, you can use one of the
|
71
|
+
existing Google APIs from https://github.com/googleapis/googleapis.
|
32
72
|
First you should get the protos and dependencies:
|
33
73
|
|
34
74
|
```sh
|
35
|
-
$ git clone git@github.com:googleapis/api-common-protos.git
|
36
75
|
$ git clone git@github.com:googleapis/googleapis.git
|
37
76
|
```
|
38
77
|
|
39
|
-
Now you're ready to compile the API:
|
78
|
+
Now you're ready to compile the API. For example, to compile the Vision V1 API:
|
40
79
|
|
41
80
|
```sh
|
42
|
-
$ protoc google/cloud/vision/v1/*.proto \
|
43
|
-
--proto_path=api-common-protos/ \
|
44
|
-
--proto_path=googleapis/ \
|
45
|
-
--ruby_gapic_out=/dest/
|
46
|
-
```
|
47
|
-
|
48
|
-
Or, if you don't have `protoc` installed, you can use `grpc_tools_ruby_protoc`
|
49
|
-
from the `grpc-tools` gem:
|
50
|
-
|
51
|
-
```sh
|
52
|
-
$ gem install grpc-tools
|
53
81
|
$ grpc_tools_ruby_protoc google/cloud/vision/v1/*.proto \
|
54
|
-
--proto_path=api-common-protos/ \
|
55
82
|
--proto_path=googleapis/ \
|
56
|
-
--
|
83
|
+
--ruby_out=/path/to/dest/ \
|
84
|
+
--grpc_out=/path/to/dest/ \
|
85
|
+
--ruby_gapic_out=/path/to/dest/ \
|
57
86
|
```
|
58
87
|
|
59
|
-
|
60
|
-
|
61
|
-
|
88
|
+
Note: most real-world client libraries require additional options to be passed
|
89
|
+
to the generator, via the `--ruby_gapic_opt` flag. Those options are not
|
90
|
+
covered in this document.
|
62
91
|
|
63
|
-
|
92
|
+
If you want to use `gapic-generator-cloud` or `gapic-generator-ads`, see the
|
93
|
+
README for that gem for specific information.
|
64
94
|
|
65
|
-
##
|
95
|
+
## Support
|
66
96
|
|
67
|
-
This
|
68
|
-
|
97
|
+
This is not an official Google project. While it is being used internally to
|
98
|
+
generate official Google API client libraries, there is no guarantee of support
|
99
|
+
or stability for any other use.
|
69
100
|
|
70
|
-
|
101
|
+
As of January 2024, this generator can be run on Ruby 3.0 or later. In general,
|
102
|
+
we will make an effort to ensure it is supported on non-end-of-life versions of
|
103
|
+
Ruby.
|
71
104
|
|
72
|
-
|
105
|
+
Issues can be filed on GitHub at
|
106
|
+
https://github.com/googleapis/gapic-generator-ruby/issues.
|
data/bin/protoc-gen-ruby_gapic
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
$LOAD_PATH.unshift ::File.expand_path("../lib", __dir__)
|
19
19
|
require "gapic/runner"
|
20
|
-
require "google/protobuf/compiler/
|
20
|
+
require "google/protobuf/compiler/plugin_pb"
|
21
21
|
|
22
22
|
# Ensure that no encoding conversions are done on STDIN and STDOUT
|
23
23
|
# since we are passing binary data back and forth. Otherwise these
|
@@ -30,4 +30,4 @@ request = Google::Protobuf::Compiler::CodeGeneratorRequest.decode $stdin.read
|
|
30
30
|
# Run the request
|
31
31
|
response = Gapic::Runner.run request
|
32
32
|
|
33
|
-
$stdout.print response
|
33
|
+
$stdout.print Google::Protobuf::Compiler::CodeGeneratorResponse.encode response
|
data/lib/gapic/file_formatter.rb
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
|
17
17
|
require "tmpdir"
|
18
18
|
require "fileutils"
|
19
|
+
require "English"
|
19
20
|
|
20
21
|
module Gapic
|
21
22
|
##
|
@@ -29,34 +30,37 @@ module Gapic
|
|
29
30
|
#
|
30
31
|
def initialize configuration, files
|
31
32
|
@configuration = configuration
|
32
|
-
@files = format!
|
33
|
+
@files = format! files
|
33
34
|
end
|
34
35
|
|
35
36
|
protected
|
36
37
|
|
37
|
-
def format!
|
38
|
+
def format! files
|
38
39
|
Dir.mktmpdir do |dir|
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
Dir.chdir dir do
|
41
|
+
files.each do |file|
|
42
|
+
FileUtils.mkdir_p File.dirname file.name
|
43
|
+
File.write file.name, file.content
|
44
|
+
end
|
42
45
|
|
43
|
-
|
46
|
+
# Use the current Ruby binary path and invoke the CLI class directly
|
47
|
+
# rather than the normal rubocop executable, since the latter uses
|
48
|
+
# "/usr/bin/env ruby" which doesn't seem to work in the current bazel
|
49
|
+
# environment.
|
50
|
+
script = 'require "rubocop"; begin; RuboCop::CLI.new.run; rescue => e; p e; exit 1; end'
|
51
|
+
rubocop_cmd = "#{RbConfig.ruby} -e '#{script}' -- --cache false -a -o rubocop.out -c #{configuration}"
|
52
|
+
output = `#{rubocop_cmd}`.strip
|
53
|
+
unless output.empty?
|
54
|
+
warn "**** Rubocop output:"
|
55
|
+
warn output
|
56
|
+
end
|
57
|
+
raise "Rubocop failed" unless $CHILD_STATUS.success?
|
44
58
|
|
45
|
-
|
46
|
-
|
59
|
+
files.each do |file|
|
60
|
+
file.content = File.read file.name
|
61
|
+
end
|
47
62
|
end
|
48
63
|
end
|
49
64
|
end
|
50
|
-
|
51
|
-
def write_file dir, file
|
52
|
-
tmp_file = File.join dir, file.name
|
53
|
-
FileUtils.mkdir_p File.dirname tmp_file
|
54
|
-
File.write tmp_file, file.content
|
55
|
-
end
|
56
|
-
|
57
|
-
def read_file dir, file
|
58
|
-
tmp_file = File.join dir, file.name
|
59
|
-
file.content = File.read tmp_file
|
60
|
-
end
|
61
65
|
end
|
62
66
|
end
|
@@ -39,9 +39,12 @@ module Gapic
|
|
39
39
|
# @param disable_xrefs [Boolean] (default is `false`) Disable linking to
|
40
40
|
# cross-references, and render them simply as text. This can be used if
|
41
41
|
# it is known that the targets are not present in the current library.
|
42
|
+
# @param transport [:grpc,:rest] Whether xref links should go to REST or
|
43
|
+
# gRPC client classes. Uses the default transport if not provided.
|
42
44
|
# @return [Enumerable<String>]
|
43
45
|
#
|
44
|
-
def format_doc_lines api, lines, disable_xrefs: false
|
46
|
+
def format_doc_lines api, lines, disable_xrefs: false, transport: nil
|
47
|
+
transport ||= api&.default_transport || :grpc
|
45
48
|
# To detect preformatted blocks, this tracks the "expected" base indent
|
46
49
|
# according to Markdown. Specifically, this is the effective indent of
|
47
50
|
# previous block, which is normally 0 except if we're in a list item.
|
@@ -58,7 +61,7 @@ module Gapic
|
|
58
61
|
in_block, base_indent = update_indent_state in_block, base_indent, line, indent
|
59
62
|
if in_block == false
|
60
63
|
line = escape_line_braces line
|
61
|
-
line = format_line_xrefs api, line, disable_xrefs
|
64
|
+
line = format_line_xrefs api, line, disable_xrefs, transport
|
62
65
|
end
|
63
66
|
end
|
64
67
|
line
|
@@ -109,12 +112,12 @@ module Gapic
|
|
109
112
|
line
|
110
113
|
end
|
111
114
|
|
112
|
-
def format_line_xrefs api, line, disable_xrefs
|
115
|
+
def format_line_xrefs api, line, disable_xrefs, transport
|
113
116
|
while (m = @xref_detector.match line)
|
114
117
|
entity = api.lookup m[:addr]
|
115
118
|
return line if entity.nil?
|
116
119
|
text = m[:text]
|
117
|
-
yard_link = disable_xrefs ? text : yard_link_for_entity(entity, text)
|
120
|
+
yard_link = disable_xrefs ? text : yard_link_for_entity(entity, text, transport)
|
118
121
|
return line if yard_link.nil?
|
119
122
|
line = "#{m[:pre]}#{yard_link}#{m[:post]}"
|
120
123
|
end
|
@@ -126,9 +129,10 @@ module Gapic
|
|
126
129
|
#
|
127
130
|
# @param entity [Gapic::Schema::Proto] the entity to link to
|
128
131
|
# @param text [String] the text for the link
|
132
|
+
# @param transport [:rest,:grpc] The transport for client classes
|
129
133
|
# @return [String] YARD cross-reference syntax
|
130
134
|
#
|
131
|
-
def yard_link_for_entity entity, text
|
135
|
+
def yard_link_for_entity entity, text, transport
|
132
136
|
# As a special case, omit the service "google.longrunning.Operations"
|
133
137
|
# and its methods. This is because the generator creates
|
134
138
|
# service-specific copies of the operations client, rather than a
|
@@ -136,11 +140,14 @@ module Gapic
|
|
136
140
|
# general no way to tell what the actual service-specific namespace is.
|
137
141
|
return text if entity.address[0, 3] == ["google", "longrunning", "Operations"]
|
138
142
|
|
143
|
+
client_class = transport == :grpc ? "Client" : "Rest::Client"
|
139
144
|
case entity
|
140
145
|
when Gapic::Schema::Service
|
141
|
-
"{::#{convert_address_to_ruby entity}
|
146
|
+
"{::#{convert_address_to_ruby entity, service: true}::#{client_class} #{text}}"
|
142
147
|
when Gapic::Schema::Method
|
143
|
-
|
148
|
+
namespace = convert_address_to_ruby entity.parent, service: true
|
149
|
+
method_name = entity.name.underscore
|
150
|
+
"{::#{namespace}::#{client_class}##{method_name} #{text}}"
|
144
151
|
when Gapic::Schema::Message, Gapic::Schema::Enum
|
145
152
|
"{::#{convert_address_to_ruby entity} #{text}}"
|
146
153
|
when Gapic::Schema::EnumValue
|
@@ -150,13 +157,19 @@ module Gapic
|
|
150
157
|
end
|
151
158
|
end
|
152
159
|
|
153
|
-
def convert_address_to_ruby entity
|
160
|
+
def convert_address_to_ruby entity, service: false
|
154
161
|
file = entity.containing_file
|
155
162
|
api = file.containing_api
|
156
163
|
address = entity.address
|
157
164
|
address = address.join "." if address.is_a? Array
|
158
165
|
address = address.sub file.package, file.ruby_package if file.ruby_package&.present?
|
159
|
-
address.split(/\.|::/).reject(&:empty?)
|
166
|
+
address = address.split(/\.|::/).reject(&:empty?)
|
167
|
+
last_index = address.size - 1 if service
|
168
|
+
address.each_with_index.map do |node, index|
|
169
|
+
node = node.camelize
|
170
|
+
node = api.fix_service_name node if index == last_index
|
171
|
+
api.fix_namespace node
|
172
|
+
end.join "::"
|
160
173
|
end
|
161
174
|
end
|
162
175
|
end
|
data/lib/gapic/gem_builder.rb
CHANGED
@@ -37,23 +37,21 @@ module Gapic
|
|
37
37
|
# Writes all the files for the gem.
|
38
38
|
#
|
39
39
|
def bootstrap
|
40
|
-
gen "readme
|
41
|
-
gen "gemspec
|
42
|
-
gen "rakefile
|
43
|
-
gen "gemfile
|
44
|
-
gen "gitignore
|
45
|
-
gen "rubocop
|
46
|
-
gen "dockerfile
|
47
|
-
gen "entrypoint
|
48
|
-
gen "gapic_sh
|
49
|
-
gen "binary
|
50
|
-
gen "generator.
|
51
|
-
|
52
|
-
gen "
|
53
|
-
|
54
|
-
|
55
|
-
gen "test_generator.erb", "test/generators/#{gem_name}_test.rb"
|
56
|
-
cp "speech_desc.bin", "proto_input/speech_desc.bin"
|
40
|
+
gen "readme", "README.md"
|
41
|
+
gen "gemspec", "gapic-generator-#{gem_name}.gemspec"
|
42
|
+
gen "rakefile", "Rakefile"
|
43
|
+
gen "gemfile", "Gemfile"
|
44
|
+
gen "gitignore", ".gitignore"
|
45
|
+
gen "rubocop", ".rubocop.yml"
|
46
|
+
gen "dockerfile", "Dockerfile"
|
47
|
+
gen "entrypoint", "docker-entrypoint.sh"
|
48
|
+
gen "gapic_sh", "gapic.sh"
|
49
|
+
gen "binary", "bin/protoc-gen-ruby_#{gem_name}"
|
50
|
+
gen "generator", "lib/gapic/generators/#{gem_name}_generator.rb"
|
51
|
+
gen "version", "lib/gapic/generator/#{gem_name}/version.rb"
|
52
|
+
gen "test_helper", "test/test_helper.rb"
|
53
|
+
gen "test_generator", "test/generators/#{gem_name}_test.rb"
|
54
|
+
cp "speech_desc.bin", "proto_input/speech_desc.bin"
|
57
55
|
end
|
58
56
|
|
59
57
|
private
|