feat(generator): add HttpJsonServiceResumableUploadStubClassComposer - #14321
feat(generator): add HttpJsonServiceResumableUploadStubClassComposer#14321whowes wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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.
| 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())) |
There was a problem hiding this comment.
Retrieve the type name using ApiMethodDescriptor.class.getSimpleName() instead of a hardcoded string literal to ensure compile-time safety and consistency.
| 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")) |
There was a problem hiding this comment.
| List<AnnotationNode> annotations = new ArrayList<>(); | ||
| annotations.add( | ||
| AnnotationNode.builder() | ||
| .setType(FIXED_TYPESTORE.get("Generated")) |
There was a problem hiding this comment.
f246196 to
1885bb8
Compare
1885bb8 to
542f6e7
Compare
542f6e7 to
6f00489
Compare
Add HttpJsonServiceResumableUploadStubClassComposer to generate dedicated REST stub classes (HttpJson[Service]ResumableUploadStub) for services containing resumable upload RPC methods.
6f00489 to
296ed15
Compare
|
|



Introduces
HttpJsonServiceResumableUploadStubClassComposerto 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.