DRAFT feat(gapic-generator): add support for resumable uploads - #18354
DRAFT feat(gapic-generator): add support for resumable uploads#18354parthea wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for resumable upload methods in the GAPIC generator, updating schema wrappers, templates, and options to handle media upload protocols, while adding comprehensive system and unit tests. Feedback on the changes suggests avoiding potential breaking changes by generating media upload methods as standard RPCs when resumable_upload_prefix is not configured, rather than omitting them entirely. Additionally, it is recommended to deduplicate helper functions like resume_resumable_upload and make_resumable_upload across the newly added system test files by moving them to a shared utility module or conftest.py.
| if self._is_media_upload_proto(meth_pb) and not self.opts.resumable_upload_prefix: | ||
| continue |
There was a problem hiding this comment.
Skipping the generation of media upload methods entirely when resumable_upload_prefix is not configured can introduce breaking changes for downstream users who previously relied on these methods being generated as standard RPCs. Consider allowing them to be generated as standard (non-resumable) methods instead of omitting them completely.
References
- Do not replace historical graceful fallback behaviors with exceptions or omit them if doing so would introduce breaking changes for downstream users and violate backwards compatibility.
| def resume_resumable_upload( | ||
| transport, | ||
| upload_url, | ||
| stream, | ||
| size=None, | ||
| config=None, | ||
| **kwargs, | ||
| ): |
There was a problem hiding this comment.
The helper function resume_resumable_upload (and make_resumable_upload in other files) is duplicated across multiple test files (e.g., test_resumable_upload_basic.py, test_resumable_upload_resume.py, test_resumable_upload_errors.py, etc.). To improve maintainability and reduce code duplication, consider moving these helpers to a shared utility module or defining them in conftest.py.
References
- Remove duplicate lines of code, especially duplicate assertions in tests, to keep the codebase clean and avoid redundancy.
Towards b/457416314, b/556259599