-
Notifications
You must be signed in to change notification settings - Fork 129
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3305 +/- ##
=========================================
Coverage 87.13% 87.14%
- Complexity 6115 6120 +5
=========================================
Files 495 495
Lines 24159 24172 +13
Branches 2634 2637 +3
=========================================
+ Hits 21051 21064 +13
Misses 2242 2242
Partials 866 866
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Only nits so far, but please wait for @vam-google to TAL.
namer.getAndSaveNicknameForGrpcClientTypeName( | ||
context.getImportTypeTable(), context.getInterfaceModel()); | ||
apiImplClass.grpcClientTypeName(grpcClientTypeName); | ||
if (supportsGrpcTransport()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a comment before this if
block making it explicitly that we're generating GAPICs that support only one transport for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For PHP, this block generates a GAPIC that supports both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added comments to clarify, let me know if this is sufficient!
src/main/java/com/google/api/codegen/transformer/php/PhpGapicSurfaceTransformer.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/api/codegen/transformer/php/PhpGapicSurfaceTransformer.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. Just a few comments.
I'm also worried a bit about the addition of one more huge test file library_rest.proto
. Why can't we use one of the existing library.proto
. Is it because of streaming methods?
} else { | ||
// PHP generates a client that only supports REST | ||
apiImplClass.grpcClientTypeName(""); | ||
apiImplClass.stubs(new ArrayList<>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: probably Collections.emptyList()
is what you need here.
@@ -426,6 +437,9 @@ private RestPlaceholderConfigView generateRestPlaceholderConfigView( | |||
List<GrpcStreamingDetailView> result = new ArrayList<>(); | |||
|
|||
for (MethodModel method : context.getGrpcStreamingMethods()) { | |||
if (!supportsGrpcTransport()) { | |||
throw new RuntimeException("Streaming methods only valid for gRPC transport"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will this behave for existing APIs? There are many APIs that PHP generates the multitransport client and those have streaming methods. I believe in that case PHP still creates a client, just the streaming methods are no-op, but the generation itself does not fail and all the non-streaming methods are present in the generated surface. Will make gapic-generator throwing exception for such APIs and failing the whole generation process as a result?
Also, please do not use RuntimeException
directly. It is an exception designed to be a base for the other specific exceptions. Please pick something more specific (UnsupportedOperation or something like that)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Resubmission of #3301 from origin so all tests pass
supportsGrpcTransport
, which returns false whentransport_protocol
is set toREST
transport
andtransportConfig
service clients options omitgrpc
gcpApiConfigPath
config ingetClientDefaults
defaultTransport
andgetSupportedTransport
functions to override the transport verification functionality ingoogle/gax