When using gRPC UI, I came across a scenario where I did not want default values emitted to the Response tab. While gRPCurl has an option to enable/disable emit-defaults, gRPC UI does not since the call it makes to gRPCurl hard-codes emit-defaults to true. Thus, there was an inconsistency between these two closely related tools.
Problem Statement
When using gRPC UI, I came across a scenario where I did not want default values emitted to the Response tab. While gRPCurl has an option to enable/disable emit-defaults, gRPC UI does not since the call it makes to gRPCurl hard-codes emit-defaults to true. Thus, there was an inconsistency between these two closely related tools.
Example Proto File
Sample Server Implementation - Written in Go
server.txt
gRPC UI Output
gRPCurl Output with
-emit-defaults=false
Fix
emit-defaults
flag to thecmd/grpcui.go
file.handlers.go
to accept value ofemit-defaults
flag.true
, to preserve existing behaviorgRPC UI Output After Fix with
-emit-defaults=false