Skip to content

feat(internal/sidekick/rust): make GAPIC builders extensible - #7782

Merged
dbolduc merged 2 commits into
googleapis:mainfrom
dbolduc:rust-extensible-builders
Oct 13, 2026
Merged

dbolduc merged 2 commits into
googleapis:mainfrom
dbolduc:rust-extensible-builders

Conversation

@dbolduc

@dbolduc dbolduc commented Oct 13, 2026

Copy link
Copy Markdown
Member

Make the request object in a builder pub(crate) as needed.

We use a codec option instead of changing all GAPICs because our tooling would flag every crate as needing a version bump. We would rather keep the diff down and have one extra knob.

Motivation:

…le_builders

Allow Rust libraries to configure extensible_builders in librarian.yaml with a list of method IDs whose generated request builders expose pub(crate) internals. Services with at least one extensible builder emit pub(crate) fields on RequestBuilder, and methods in extensible_builders emit pub(crate) on their request builder tuple struct.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for "extensible builders" in the Rust generator by adding a new configuration option extensible_builders to specify method IDs whose generated request builders expose pub(crate) internals. The changes span configuration schema updates, Go codec parsing, and template modifications in builder.rs.gotmpl. The review feedback recommends simplifying the template modifications by using inline if directives to conditionally prepend pub(crate) to fields and structs, avoiding code duplication and keeping the template DRY.

@dbolduc
dbolduc merged commit f64425b into googleapis:main Oct 13, 2026
47 of 49 checks passed
@dbolduc
dbolduc deleted the rust-extensible-builders branch October 13, 2026 18:17
{{- else }}
#[derive(Clone, Debug)]
{{ .Codec.BuilderVisibility }} struct {{ .Codec.BuilderName }}(RequestBuilder<{{ .InputType.Codec.QualifiedName }}>);
{{ .Codec.BuilderVisibility }} struct {{ .Codec.BuilderName }}({{ if .Codec.ExtensibleBuilder }}pub(crate) {{ end }}RequestBuilder<{{ .InputType.Codec.QualifiedName }}>);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? Can tuples have field visibility?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently tuple structs can

dbolduc added a commit to googleapis/google-cloud-rust that referenced this pull request Oct 13, 2026
Pick up googleapis/librarian#7782 and use it to
move the source of truth for the custom poller implementation from
librarian templates to google-cloud-rust
dbolduc added a commit that referenced this pull request Oct 15, 2026
I did not go far enough in #7782. We also need this option available at
the module level, not just the crate level.
suztomo pushed a commit that referenced this pull request Oct 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.49.0](v0.48.0...v0.49.0)
(2026-10-19)


### Features

* **internal/librarian/ruby:** copy sibling API `ruby_cloud_opts`
([#7789](#7789))
([108eacd](108eacd))
* **internal/sidekick/rust:** extensible builders for module
([#7784](#7784))
([7f41f9c](7f41f9c))
* **internal/sidekick/rust:** make GAPIC builders extensible
([#7782](#7782))
([f64425b](f64425b))
* **internal/sidekick/rust:** mark keep modules as internal
([#7781](#7781))
([6b0bf3b](6b0bf3b))
* **sidekick/swift:** mark .with helper as
[@inlinable](https://github.com/inlinable)
([#7785](#7785))
([984188e](984188e))


### Bug Fixes

* **internal/librarian/java:** strip google/devicesandservices/ prefix
([#7788](#7788))
([49220d5](49220d5))
* **parser/protobuf:** resolve HttpBody wildcards
([#7780](#7780))
([a30365b](a30365b)),
refs [#7779](#7779)
* **sidekick/swift:** configure client header at init
([#7792](#7792))
([7b9c44c](7b9c44c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants