Skip to content

Commit

Permalink
grpc-gateway: emit default (zero-value) fields
Browse files Browse the repository at this point in the history
Some existing clients are not as nimble at distinguishing the explicit
empty vs implicit empty cases.
  • Loading branch information
jgraettinger committed Sep 24, 2024
1 parent 7392043 commit 73afb30
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/gazette/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (cmdServe) Execute(args []string) error {
pb.RegisterJournalServer(srv.GRPCServer, pb.NewVerifiedJournalServer(service, verifier))

var mux *runtime.ServeMux = runtime.NewServeMux(
runtime.WithMarshalerOption(runtime.MIMEWildcard, new(gateway.JSONPb)),
runtime.WithMarshalerOption(runtime.MIMEWildcard, &gateway.JSONPb{EmitDefaults: true}),
runtime.WithProtoErrorHandler(runtime.DefaultHTTPProtoErrorHandler),
)
pb.RegisterJournalHandler(tasks.Context(), mux, srv.GRPCLoopback)
Expand Down
2 changes: 1 addition & 1 deletion mainboilerplate/runconsumer/run_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (sc Cmd) Execute(args []string) error {
pc.RegisterShardServer(srv.GRPCServer, pc.NewVerifiedShardServer(service, service.Verifier))

var mux *runtime.ServeMux = runtime.NewServeMux(
runtime.WithMarshalerOption(runtime.MIMEWildcard, new(gateway.JSONPb)),
runtime.WithMarshalerOption(runtime.MIMEWildcard, &gateway.JSONPb{EmitDefaults: true}),
runtime.WithProtoErrorHandler(runtime.DefaultHTTPProtoErrorHandler),
)
pc.RegisterShardHandler(tasks.Context(), mux, srv.GRPCLoopback)
Expand Down

0 comments on commit 73afb30

Please sign in to comment.