Open zengzhengrong opened 4 years ago
You can override global marshaler using httpruntime:
https://github.com/utrack/clay/blob/master/transport/httpruntime/mjson.go#L13
httpruntime.OverrideMarshaler("application/json",httpruntime.MarshalerPbJSON{
Marshaler: &runtime.JSONPb{EmitDefaults: true},
Unmarshaler: &runtime.JSONPb{},
GogoMarshaler: &gogojsonpb.Marshaler{EmitDefaults:true},
GogoUnmarshaler: &gogojsonpb.Unmarshaler{},
})
I will prepare https://github.com/utrack/clay/issues/84 After closing that issue you'll be able to configure this param
https://stackoverflow.com/questions/34716238/golang-protobuf-remove-omitempty-tag-from-generated-json-tags The zero vaule of field be omited, I remove omitempty flag in struct, but it do not work in reponse