Skip to content

Commit

Permalink
fix(spring): update hasRestOption to exclude services with no rest-su…
Browse files Browse the repository at this point in the history
…pported methods (#1343)
  • Loading branch information
emmileaf authored Feb 9, 2023
1 parent 26c2e12 commit 3f5db4d
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,17 @@ public GapicClass generate(GapicContext context, Service service) {

Expr thisExpr = ValueExpr.withValue(ThisObjectValue.withType(dynamicTypes.get(className)));
Transport transport = context.transport();
boolean hasRestOption = transport.equals(Transport.GRPC_REST);
// TODO(emmwang): this condition is adapted from latest gapic-generator-java changes as part of
// https://github.com/googleapis/gapic-generator-java/issues/1117, but should be updated to use
// the gapic-implemented helpers once spring generator code is migrated.
boolean hasRestSupportedMethod =
service.methods().stream()
.anyMatch(
x ->
x.httpBindings() != null
&& x.stream() != Method.Stream.BIDI
&& x.stream() != Method.Stream.CLIENT);
boolean hasRestOption = transport.equals(Transport.GRPC_REST) && hasRestSupportedMethod;
String serviceSettingsMethodName = JavaStyle.toLowerCamelCase(service.name()) + "Settings";

ClassDefinition classDef =
Expand Down

0 comments on commit 3f5db4d

Please sign in to comment.