Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions temporalproto/json_marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ type CustomJSONMarshalOptions struct {
// terminated by a newline. If non-empty, then Multiline is treated as true.
// Indent can only be composed of space or tab characters.
Indent string

// EmitDefaultValues specifies whether to emit default-valued primitive
// fields, empty lists, and empty maps. Presence-sensing fields that are
// unset remain omitted rather than being emitted as "null".
EmitDefaultValues bool
}

// Marshal marshals the given [proto.Message] in the JSON format using options in
// MarshalOptions. Do not depend on the output being stable. It may change over
// time across different versions of the program.
func (o CustomJSONMarshalOptions) Marshal(m proto.Message) ([]byte, error) {
return protojson.MarshalOptions{
Indent: o.Indent,
Metadata: o.Metadata,
Indent: o.Indent,
Metadata: o.Metadata,
EmitDefaultValues: o.EmitDefaultValues,
}.Marshal(m)
}
Loading