fix proto options (#804)

pull/811/head v2.0.0-beta3
Tony Chen 4 years ago committed by GitHub
parent 1ee3225155
commit a0fe496a91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      config/reader.go

@ -110,14 +110,14 @@ func convertMap(src interface{}) interface{} {
func marshalJSON(v interface{}) ([]byte, error) {
if m, ok := v.(proto.Message); ok {
return protojson.Marshal(m)
return protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(m)
}
return json.Marshal(v)
}
func unmarshalJSON(data []byte, v interface{}) error {
if m, ok := v.(proto.Message); ok {
return protojson.Unmarshal(data, m)
return protojson.UnmarshalOptions{DiscardUnknown: true}.Unmarshal(data, m)
}
return json.Unmarshal(data, v)
}

Loading…
Cancel
Save