gapic-generator 0.47.1 → 0.48.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85080fd14e5e27a8df3ceab07bab66561e846bfecd776a2296194534d8bbeb75
4
- data.tar.gz: fae81b0c5525d979141c327b4282c8eb93026a4533855006fe850b6c767b1076
3
+ metadata.gz: 0dce081dcba1081cbc1d70ea2ba48cfe5d1b6d0d9312f655498a9b67118475d0
4
+ data.tar.gz: 1b99595150e4906d28041be94e84a63d53e0385d482bfe9c740de1d1ae776a5e
5
5
  SHA512:
6
- metadata.gz: 3d93ed47c14a6008ec72ea60b51105f3b898ec7606feea171e0927bd7ca3f37267f5fcd5bc3b4f16a5fca8f321c24d25d29b62b995e275fcfcb803e858c1d0dd
7
- data.tar.gz: c81c885b285e0406200b9e8350f69156a706be854a0be8ffc86ededd7943947ced4ec3124776071e8ef99bfed55cfe5846df1725e94643946438068655e839bd
6
+ metadata.gz: 1cf615c4a0d4fd410bc0e611f2bf789da9bb3f111933d4d302601f34115222cf8296afb40f08fc0c131bfe7ba97a7797176883f40c7d7fc88ec998b4c5dcce76
7
+ data.tar.gz: '08cb6a4fc4f8bac7397ff675124e05558566d942bf4a678fb0f5668424e98eaf49b72766e39d0148d6ce3c412e4745340bcb5f663f99a34b19f2e08e81197d6e'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Release History for gapic-generator
2
2
 
3
+ ### 0.48.0 / 2026-03-13
4
+
5
+ * Fix: add per-service apiVersion to gapic_metadata
6
+ * Fix: add api_version breadcrumb to client docs
7
+ * Feature: Upgrade dependencies for Ruby 4.0
8
+
9
+ ### 0.47.2 / 2025-10-22
10
+
11
+ * Fix: Deprecate credentials via string or hash
12
+
3
13
  ### 0.47.1 / 2025-09-11
4
14
 
5
15
  No significant changes
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Gapic
18
18
  module Generator
19
- VERSION = "0.47.1"
19
+ VERSION = "0.48.0"
20
20
  end
21
21
  end
@@ -526,7 +526,7 @@ module Gapic
526
526
  #
527
527
  # @return [Hash]
528
528
  def drift_manifest
529
- {
529
+ h = {
530
530
  clients: {
531
531
  grpc: {
532
532
  libraryClient: client_name_full,
@@ -538,6 +538,8 @@ module Gapic
538
538
  }
539
539
  }
540
540
  }
541
+ h[:apiVersion] = @service.api_version unless @service.api_version.empty?
542
+ h
541
543
  end
542
544
 
543
545
  ##
@@ -347,6 +347,18 @@ module Gapic
347
347
  @address.join "."
348
348
  end
349
349
 
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
+
350
362
  # @!method name
351
363
  # @return [String] the unqualified name of the service.
352
364
  # @!method options
@@ -3,10 +3,12 @@ source "https://rubygems.org"
3
3
 
4
4
  gemspec
5
5
 
6
- gem "google-style", "~> 1.31.1"
7
- gem "minitest", "~> 5.22"
6
+ gem "google-style", "~> 1.32.0"
7
+ gem "minitest", "~> 6.0.2"
8
8
  gem "minitest-focus", "~> 1.4"
9
+ gem "minitest-mock", "~> 5.27"
9
10
  gem "minitest-rg", "~> 5.3"
11
+ gem "ostruct", "~> 0.5.5"
10
12
  gem "rake", ">= 13.0"
11
13
  gem "redcarpet", "~> 3.6"
12
14
  gem "yard", "~> 0.9"
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
22
22
  <%= gem.extra_files.inspect %>
23
23
  gem.require_paths = ["lib"]
24
24
 
25
- gem.required_ruby_version = ">= 3.1"
25
+ gem.required_ruby_version = ">= 3.2"
26
26
 
27
27
  <%- gem.dependency_list.each do |name, requirements| -%>
28
28
  gem.add_dependency <%= name.inspect %>, <%= requirements.map { |v| v.inspect }.join ", " %>
@@ -3,6 +3,7 @@
3
3
 
4
4
  require "minitest/autorun"
5
5
  require "minitest/focus"
6
+ require "minitest/mock"
6
7
  require "minitest/rg"
7
8
 
8
9
  require "grpc"
@@ -37,8 +37,6 @@
37
37
  # @return [::String,nil]
38
38
  # @!attribute [rw] credentials
39
39
  # Credentials to send with calls. You may provide any of the following types:
40
- # * (`String`) The path to a service account key file in JSON format
41
- # * (`Hash`) A service account key as a Hash
42
40
  # * (`Google::Auth::Credentials`) A googleauth credentials object
43
41
  # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
44
42
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
@@ -47,7 +45,26 @@
47
45
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
48
46
  # * (`nil`) indicating no credentials
49
47
  #
50
- # Warning: If you accept a credential configuration (JSON file or Hash) from an
48
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
49
+ # is deprecated. Providing an unvalidated credential configuration to
50
+ # Google APIs can compromise the security of your systems and data.
51
+ #
52
+ # @example
53
+ #
54
+ # # The recommended way to provide credentials is to use the `make_creds` method
55
+ # # on the appropriate credentials class for your environment.
56
+ #
57
+ # require "googleauth"
58
+ #
59
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
60
+ # json_key_io: ::File.open("/path/to/keyfile.json")
61
+ # )
62
+ #
63
+ # client = <%= service.client_name_full %>.new do |config|
64
+ # config.credentials = credentials
65
+ # end
66
+ #
67
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
51
68
  # external source for authentication to Google Cloud, you must validate it before
52
69
  # providing it to a Google API client library. Providing an unvalidated credential
53
70
  # configuration to Google APIs can compromise the security of your systems and data.
@@ -16,6 +16,26 @@ class <%= service.client_name_full %>Test < Minitest::Test
16
16
 
17
17
  <%- end -%>
18
18
  <%= indent render(partial: "service/test/method/configure", locals: { service: service }), 2 %>
19
+
20
+ def test_credentials
21
+ key = OpenSSL::PKey::RSA.new 2048
22
+ cred_json = {
23
+ "private_key" => key.to_pem,
24
+ "client_email" => "app@developer.gserviceaccount.com",
25
+ "type" => "service_account"
26
+ }
27
+ key_file = StringIO.new cred_json.to_json
28
+ creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file })
29
+
30
+ dummy_stub = ClientStub.new nil, nil
31
+ Gapic::ServiceStub.stub :new, dummy_stub do
32
+ client = <%= service.client_name_full %>.new do |config|
33
+ config.credentials = creds
34
+ end
35
+ assert_kind_of <%= service.client_name_full %>, client
36
+ assert_equal creds, client.configure.credentials
37
+ end
38
+ end
19
39
  <%- if service.lro? -%>
20
40
 
21
41
  def test_<%= service.lro_client_var %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gapic-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.47.1
4
+ version: 0.48.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernest Landrito
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 1.31.1
90
+ version: 1.32.0
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 1.31.1
97
+ version: 1.32.0
98
98
  email:
99
99
  - landrito@google.com
100
100
  - quartzmo@gmail.com
@@ -358,7 +358,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
358
358
  requirements:
359
359
  - - ">="
360
360
  - !ruby/object:Gem::Version
361
- version: '3.1'
361
+ version: '3.2'
362
362
  required_rubygems_version: !ruby/object:Gem::Requirement
363
363
  requirements:
364
364
  - - ">="