You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue both provides temporary workaround for those who have same issues, and suggests new feature that allows solving the issue officially on connect.
Feature Request
Add new func to create customized protoJSONCodec and allow configuring protojson.MarshalOptions through it.
Is your feature request related to a problem? Please describe.
By Protobuf spec, the JSON fields with default values (e.g. zero values for primitives) are omitted from output.
When generating JSON-encoded output from a protocol buffer, if a protobuf field has the default value and if the field doesn’t support field presence, it will be omitted from the output by default.
Thus, given following protobuf message and input, Connect generates JSON with lack of fields with the default values.
This issue both provides temporary workaround for those who have same issues, and suggests new feature that allows solving the issue officially on connect.
Feature Request
Add new func to create customized
protoJSONCodec
and allow configuringprotojson.MarshalOptions
through it.The Problem
Is your feature request related to a problem? Please describe.
By Protobuf spec, the JSON fields with default values (e.g. zero values for primitives) are omitted from output.
Thus, given following protobuf message and input, Connect generates JSON with lack of fields with the default values.
This issue also happens with non-connect gRPC implementation, for example:
omitempty
golang/protobuf#1371And in that issue, the workaround is suggested as to use protojson.MarshalOptions to override that behavior.
Temporary workaround
Describe alternatives you've considered
Meanwhile, I have confirmed that adding following code to my app and pass it as option to connect handler solved the issue.
and retrieve handler option from
withProtoJSONCodecs()
and pass it to any handler:Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: