Conversation
Adds the `resumable_upload_methods` generator parameter: a semicolon-separated list of `Service.Method` pairs. Selected methods are augmented with a resumable upload descriptor, removed from the simple methods list, and exposed on the service as `resumableUploads`, which the templates use to generate the resumable upload clients. Plumbs the parameter through the CLI, the bazel rule and the naming options, and refreshes the pubsub api dump baselines for the new `resumableUploads` field.
Templates for the cjs and esm flavors now turn methods selected with `resumable_upload_methods` into resumable upload methods: - expose a ResumableUploadDescriptor for each selected method and wire the gax resumableUploadStub into the client's inner API calls - keep the methods out of the service stub used for unary/paging calls - add the getResumableSource() helper and the session-returning method, which require an HTTP(S) transport and reject gRPC channel credentials - generate sample snippets for resumable upload methods Adds a synthetic resumable.proto fixture, the resumable-upload and resumable-upload-esm baseline tests, and baselines generated with the current templates.
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for generating resumable upload methods in the GAPIC generator for TypeScript. It introduces a new resumable_upload_methods configuration option, updates the generator schema and templates (for both CommonJS and ESM formats) to generate the necessary client methods and sample code, and adds corresponding unit and baseline tests. The review feedback is highly constructive, pointing out an unsafe non-null assertion on the service name that should use a safe fallback, and identifying redundant empty conditional blocks in the sample templates that cause unnecessary blank lines.
`{% if method.resumableUpload %}` had an empty body, so its only effect
was an extra newline: resumable upload samples rendered two blank lines
after the require, where every other generated sample has one. Remove
the block and regenerate the affected create_resumable_upload baselines
for both the cjs and esm variants.
Found by the Gemini review on googleapis#9285.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Templates for the cjs and esm flavors now turn methods selected with
resumable_upload_methodsinto resumable upload methods. This depends on the generator parameter PR in this series (merge that one first).ResumableUploadDescriptorfor each selected method and wire the gaxresumableUploadStubinto the client's inner API callsgetResumableSource()and the session-returning method, which require an HTTP(S) transport and reject gRPC channel credentialsresumable.protofixture and theresumable-upload/resumable-upload-esmbaseline testsVerification
npm run compilenpm test— 192 passing, including the two new baselinesGenerated output for existing APIs is unchanged: every template addition is guarded on the service having resumable upload methods.
Merges after: #9284
Related to: #9283