expose useful jsonpb defaults

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-11-24 15:21:36 +03:00
parent 5d3fe9018c
commit 7355dcd5a6

View File

@ -14,10 +14,26 @@ import (
)
var (
JsonpbMarshaler = &jsonpb.MarshalOptions{}
OldJsonpbMarshaler = &oldjsonpb.Marshaler{}
JsonpbUnmarshaler = &jsonpb.UnmarshalOptions{}
OldJsonpbUnmarshaler = &oldjsonpb.Unmarshaler{}
JsonpbMarshaler = jsonpb.MarshalOptions{
UseEnumNumbers: false,
EmitUnpopulated: false,
UseProtoNames: true,
AllowPartial: false,
}
JsonpbUnmarshaler = jsonpb.UnmarshalOptions{
DiscardUnknown: false,
AllowPartial: false,
}
OldJsonpbMarshaler = oldjsonpb.Marshaler{
OrigName: true,
EmitDefaults: false,
}
OldJsonpbUnmarshaler = oldjsonpb.Unmarshaler{
AllowUnknownFields: false,
}
)
type jsonpbCodec struct {