Skip to content

Commit

Permalink
[ggj][codegen] fix: ServiceStub callable types (#318)
Browse files Browse the repository at this point in the history
* feat: add protobuf comment parser util

* fix: add basic proto build rules

* feat: add header comments to ServiceClient

* fix: build protoc at test time

* fix!: wrap protobuf location and process comments

* feat: add comment parsing to methods and fields

* fix: test

* feat: add protobuf comments to ServiceClient

* fix: solidify codegen method order with TypeNode/MethodArg and Comparable

* fix: clean up tests

* fix: ServiceClient member variables and method calls

* fix: ServiceStubSettings builder type

* fix: ServiceSettings Builder construction

* fix: ServiceStub callable types
  • Loading branch information
miraleung committed Sep 19, 2020
1 parent 524b12f commit 007568b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private static MethodDefinition createCallableGetterHelper(
(isLroCallable ? "Operation" : isPaged ? "Paged" : ""));
List<Reference> genericRefs = new ArrayList<>();
genericRefs.add(method.inputType().reference());
if (method.hasLro()) {
if (method.hasLro() && isLroCallable) {
genericRefs.add(method.lro().responseType().reference());
genericRefs.add(method.lro().metadataType().reference());
} else if (isPaged) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public void generateServiceClasses() {
+ "import com.google.api.gax.rpc.OperationCallable;\n"
+ "import com.google.api.gax.rpc.ServerStreamingCallable;\n"
+ "import com.google.api.gax.rpc.UnaryCallable;\n"
+ "import com.google.longrunning.Operation;\n"
+ "import com.google.longrunning.stub.OperationsStub;\n"
+ "import com.google.showcase.v1beta1.BlockRequest;\n"
+ "import com.google.showcase.v1beta1.BlockResponse;\n"
Expand Down Expand Up @@ -120,8 +121,8 @@ public void generateServiceClasses() {
+ " chatAgainCallable()\");\n"
+ " }\n"
+ "\n"
+ " public UnaryCallable<PagedExpandRequest, PagedExpandPagedResponse> pagedExpandPagedCallable()"
+ " {\n"
+ " public UnaryCallable<PagedExpandRequest, PagedExpandPagedResponse>"
+ " pagedExpandPagedCallable() {\n"
+ " throw new UnsupportedOperationException(\"Not implemented:"
+ " pagedExpandPagedCallable()\");\n"
+ " }\n"
Expand All @@ -138,7 +139,7 @@ public void generateServiceClasses() {
+ " waitOperationCallable()\");\n"
+ " }\n"
+ "\n"
+ " public UnaryCallable<WaitRequest, WaitResponse, WaitMetadata> waitCallable() {\n"
+ " public UnaryCallable<WaitRequest, Operation> waitCallable() {\n"
+ " throw new UnsupportedOperationException(\"Not implemented: waitCallable()\");\n"
+ " }\n"
+ "\n"
Expand Down

0 comments on commit 007568b

Please sign in to comment.