Skip to content

feat(generator): add HttpJsonServiceResumableUploadStubClassComposer - #14321

Draft
whowes wants to merge 1 commit into
whowes/generator-rest-composer-helpersfrom
whowes/generator-resumable-upload-stub-composer
Draft

feat(generator): add HttpJsonServiceResumableUploadStubClassComposer#14321
whowes wants to merge 1 commit into
whowes/generator-rest-composer-helpersfrom
whowes/generator-resumable-upload-stub-composer

Conversation

@whowes

@whowes whowes commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Introduces HttpJsonServiceResumableUploadStubClassComposer to emit an internal, dedicated REST stub (HttpJson[Service]ResumableUploadStub) for the resumable upload protocol. The composer is registered in the generator pipeline and includes unit goldens locking in the generated stub class.

@whowes
whowes added this pull request to stack #14327 September 9, 2026 06:35

@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 the HttpJsonServiceResumableUploadStubClassComposer class and its corresponding test suite to support generating REST stub transport classes for resumable upload methods. The reviewer's feedback focuses on improving type safety and consistency across the codebase by replacing hardcoded string literals with class name references (such as ClientContext.class.getSimpleName(), ApiMethodDescriptor.class.getSimpleName(), ArrayList.class.getSimpleName(), and Generated.class.getSimpleName()) when retrieving types from the static FIXED_TYPESTORE.

private static List<MethodDefinition> createStaticCreatorMethods(
Service service, TypeStore typeStore, String className) {
TypeNode thisClassType = typeStore.get(className);
TypeNode clientContextType = FIXED_TYPESTORE.get("ClientContext");

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.

medium

For type safety and consistency with other parts of this class, retrieve the type name using ClientContext.class.getSimpleName() instead of a hardcoded string literal.

Suggested change
TypeNode clientContextType = FIXED_TYPESTORE.get("ClientContext");
TypeNode clientContextType = FIXED_TYPESTORE.get(ClientContext.class.getSimpleName());

.setClazz(List.class)
.setGenerics(
Arrays.asList(
FIXED_TYPESTORE.get("ApiMethodDescriptor").reference()))

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.

medium

Retrieve the type name using ApiMethodDescriptor.class.getSimpleName() instead of a hardcoded string literal to ensure compile-time safety and consistency.

Suggested change
FIXED_TYPESTORE.get("ApiMethodDescriptor").reference()))
FIXED_TYPESTORE.get(ApiMethodDescriptor.class.getSimpleName()).reference()))

.setVariableExpr(methodDescriptorsVarExpr.toBuilder().setIsDecl(true).build())
.setValueExpr(
NewObjectExpr.builder()
.setType(FIXED_TYPESTORE.get("ArrayList"))

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.

medium

Retrieve the type name using ArrayList.class.getSimpleName() instead of a hardcoded string literal to maintain consistency and avoid potential typos.

Suggested change
.setType(FIXED_TYPESTORE.get("ArrayList"))
.setType(FIXED_TYPESTORE.get(ArrayList.class.getSimpleName()))

List<AnnotationNode> annotations = new ArrayList<>();
annotations.add(
AnnotationNode.builder()
.setType(FIXED_TYPESTORE.get("Generated"))

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.

medium

Retrieve the type name using Generated.class.getSimpleName() instead of a hardcoded string literal to ensure consistency and compile-time safety.

Suggested change
.setType(FIXED_TYPESTORE.get("Generated"))
.setType(FIXED_TYPESTORE.get(Generated.class.getSimpleName()))

@whowes
whowes force-pushed the whowes/generator-resumable-upload-stub-composer branch from f246196 to 1885bb8 Compare September 9, 2026 15:50
@whowes
whowes force-pushed the whowes/generator-resumable-upload-stub-composer branch from 1885bb8 to 542f6e7 Compare September 9, 2026 20:16
@whowes
whowes removed this pull request from stack #14327 September 9, 2026 23:45
@whowes
whowes added this pull request to stack #14343 September 9, 2026 23:47
@whowes
whowes force-pushed the whowes/generator-resumable-upload-stub-composer branch from 542f6e7 to 6f00489 Compare September 9, 2026 23:51
Add HttpJsonServiceResumableUploadStubClassComposer to generate dedicated
REST stub classes (HttpJson[Service]ResumableUploadStub) for services
containing resumable upload RPC methods.
@whowes
whowes force-pushed the whowes/generator-resumable-upload-stub-composer branch from 6f00489 to 296ed15 Compare September 10, 2026 00:19
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant