gapic-generator 0.49.0 → 0.50.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: f6930660b378784b8737b799f9218f7bfb11001307036e88f71f1393d228b2a2
4
- data.tar.gz: 4c4c206b3b964eec613c55f7857f728df60663a4ce9db259e55e0197a9afcaad
3
+ metadata.gz: 2d7ec98be6131e97a365a5d526d0794c1009d93f27ab3fd4e0f92950fb731a88
4
+ data.tar.gz: 6fcf2cc7a6f3043eeb0a1e0b6d4b1433939aadef063e965a257ec1710edc433b
5
5
  SHA512:
6
- metadata.gz: d057c86b73503fb5061e9edc269881f68315d1b82234bcb96ce8cff8ba159a2e0df10ebc305962d62bf74086fad2f3492120b78e1c9686824f9a32d0d642c539
7
- data.tar.gz: 806a7130234e071fecbc953c384fad1232a5a050d0989a7f8bc0a15b26ba860c70a011cac20b130f362c74cb92f42dbee97d0acdc3afd2845963288082b3e6db
6
+ metadata.gz: 0ac32f92bfff483181c5e81b6749be9ddc005852dc4a900003d6cdd386dc6cdee6a45020c18ce30c27c98478176bd997455b6e1a2f3137e46e50a097eeae2f2e
7
+ data.tar.gz: 4542f129c100cb51b0c63238571e6cad708d2fe83b2b97dad1df3c42b60879d7d6e272635523e39d42fe85d0c9a9864a390b438eee216a135475c5f64e4bc2dc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History for gapic-generator
2
2
 
3
+ ### 0.50.0 / 2026-07-13
4
+
5
+ * Feature: Add minitest-reporters dependency and shared preloader to generator templates
6
+
3
7
  ### 0.49.0 / 2026-06-04
4
8
 
5
9
  * Feature: add retry jitter configuration
@@ -5,7 +5,7 @@
5
5
  # Creates /workspace/gapic-generator-<%= gem_name %>.gem
6
6
  # to be copied into the final runtime image.
7
7
  ##
8
- FROM ruby:2.6-stretch as builder
8
+ FROM ruby:2.6-stretch@sha256:53036d1d5886b2904a03e86400afb933ce713a03657718f1eb562c3ee93b863f as builder
9
9
  WORKDIR /workspace
10
10
 
11
11
  # Copy code from the local directory.
@@ -20,11 +20,11 @@ RUN gem build -o gapic-generator-<%= gem_name %>.gem \
20
20
  # Runtime image.
21
21
  # Installs the generator executables, common protos, and an entrypoint.
22
22
  ##
23
- FROM ruby:2.6-stretch
23
+ FROM ruby:2.6-stretch@sha256:53036d1d5886b2904a03e86400afb933ce713a03657718f1eb562c3ee93b863f
24
24
  WORKDIR /workspace
25
25
 
26
26
  # Install common protos.
27
- COPY --from=gcr.io/gapic-images/api-common-protos:beta /protos/ /workspace/common-protos/
27
+ COPY --from=gcr.io/gapic-images/api-common-protos:beta@sha256:d5725b72fc0ac14e7abf49731806c509a257e332e6a43bfa55f3674125fe120f /protos/ /workspace/common-protos/
28
28
 
29
29
  # Copy gems from the builder.
30
30
  COPY --from=builder /workspace/*.gem /workspace/
@@ -1,4 +1,3 @@
1
- Gemfile.lock
2
1
  .DS_STORE
3
2
  /.bundle/
4
3
  /.yardoc
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Gapic
18
18
  module Generator
19
- VERSION = "0.49.0"
19
+ VERSION = "0.50.0"
20
20
  end
21
21
  end
@@ -52,7 +52,8 @@ module Gapic
52
52
  end
53
53
 
54
54
  ##
55
- # Whether this is a basic double-star ("**") pattern
55
+ # Whether this is a basic double-star ("**") pattern (e.g. `{name=**}`).
56
+ # Basic double-star patterns match the entire parameter value.
56
57
  # @return [Boolean]
57
58
  def double_star_pattern?
58
59
  @segments.length == 1 && @segments[0].pattern == "**"
@@ -66,12 +67,22 @@ module Gapic
66
67
  end
67
68
 
68
69
  ##
69
- # Converts the PathPattern into a regex string
70
+ # Converts the PathPattern into a regex string.
71
+ #
72
+ # Note: Double wildcard segments (`**`) are compiled with a named capture group
73
+ # `(?<__wildcard__>.*)`. This allows the runtime library (`gapic-common`) to extract
74
+ # the isolated substring matching the wildcard.
75
+ #
70
76
  # @return [String]
71
77
  def to_regex_str
78
+ if double_star_pattern?
79
+ # If the pattern is just a double wildcard (e.g. `{name=**}`), capture everything.
80
+ return "(?<__wildcard__>.*)"
81
+ end
82
+
72
83
  regex_str = segments.first.to_regex_str
73
84
 
74
- # for double wildcards the leading `/`` is optional
85
+ # for double wildcards the leading `/` is optional
75
86
  # e.g. `foo/**` should match `foo`
76
87
  # this is why segments 'bring' the leading separator
77
88
  # with them as they build the pattern
@@ -79,7 +90,8 @@ module Gapic
79
90
  is_double_wildcard = segment.pattern == "**"
80
91
 
81
92
  regex_str = if is_double_wildcard
82
- "#{regex_str}(?:/.*)?"
93
+ # Capture the multi-segment suffix path specifically inside `__wildcard__`
94
+ "#{regex_str}(?:/(?<__wildcard__>.*))?"
83
95
  else
84
96
  "#{regex_str}/#{segment.to_regex_str}"
85
97
  end
@@ -61,8 +61,12 @@ module Gapic
61
61
  end
62
62
  end
63
63
 
64
+ # Select the primary non-common service for documentation.
65
+ # Prioritize services with methods so that the README quickstart showcases a functional client.
66
+ # If all are empty (e.g., in unit tests), fall back to the first non-common service.
64
67
  def first_non_common_service
65
- services.find { |service| service.common_service_delegate.nil? }
68
+ non_common = services.select { |service| service.common_service_delegate.nil? }
69
+ non_common.find { |service| service.methods.any? } || non_common.first
66
70
  end
67
71
 
68
72
  def proto_files
@@ -69,7 +69,7 @@ module Gapic
69
69
  @value = convert field["value"]
70
70
  @input_parameter = field["input_parameter"]
71
71
  @comment = field["comment"]
72
- @comment = nil if @comment&.empty?
72
+ @comment = nil if @comment && @comment.empty?
73
73
  @value_is_file = field["value_is_file"]
74
74
  end
75
75
 
@@ -33,7 +33,7 @@ module Gapic
33
33
  def initialize proto, json
34
34
  @name = proto.name
35
35
  @description = proto.description
36
- @description = nil if @description&.empty?
36
+ @description = nil if @description && @description.empty?
37
37
  @type = TypePresenter.new proto&.type, json&.fetch("type", nil)
38
38
  @example = ExpressionPresenter.new proto&.value, json&.fetch("value", nil)
39
39
  end
@@ -9,6 +9,7 @@ gem "minitest", "~> 6.0.2"
9
9
  gem "minitest-focus", "~> 1.4"
10
10
  gem "minitest-mock", "~> 5.27"
11
11
  gem "minitest-rg", "~> 5.3"
12
+ gem "minitest-reporters", "~> 1.8.0", require: false
12
13
  gem "ostruct", "~> 0.5.5"
13
14
  gem "rake", ">= 13.0"
14
15
  gem "redcarpet", "~> 3.6"
@@ -1,6 +1,4 @@
1
1
  <%- assert_locals gem -%>
2
- # Ignore bundler lockfiles
3
- Gemfile.lock
4
2
  gems.locked
5
3
 
6
4
  # Ignore documentation output
@@ -1,6 +1,15 @@
1
1
  <%- assert_locals gem -%>
2
2
  <%= render partial: "shared/header" -%>
3
3
 
4
+ # Load JUnit XML formatter from googleapis/ruby-common-tools to write
5
+ # tmp/reports/sponge_log.xml for Kokoro/TestGrid build health tracking.
6
+ if ENV["CI"] || ENV["KOKORO_JOB_NAME"]
7
+ begin
8
+ require "gapic/minitest_junit_preloader"
9
+ rescue LoadError
10
+ end
11
+ end
12
+
4
13
  require "minitest/autorun"
5
14
  require "minitest/focus"
6
15
  require "minitest/mock"
@@ -1,6 +1,6 @@
1
1
  <%- assert_locals package -%>
2
2
  <% @requires = capture do %>
3
- <%- package.services.each do |service| -%>
3
+ <%- package.services.select { |s| s.methods.any? }.each do |service| -%>
4
4
  require "<%= service.service_require %>"
5
5
  <%- end -%>
6
6
  require "<%= package.gem.version_require %>"
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.49.0
4
+ version: 0.50.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernest Landrito
@@ -73,14 +73,14 @@ dependencies:
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '4.30'
76
+ version: '4.32'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '4.30'
83
+ version: '4.32'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: google-style
86
86
  requirement: !ruby/object:Gem::Requirement