contrib icon indicating copy to clipboard operation
contrib copied to clipboard

entproto: Add proto3 optional label support

Open TBXark opened this issue 1 year ago • 0 comments

proto3 supports using optional fields to define optional fields, so google/protobuf/wrappers.proto does not need to be used. This will make the generated code more concise.

The EnableOptionLabel can enable this feature for a specific Message individually.

// EnableOptionalLabel enables the optional label in the generated protobuf message instead of google/protobuf/wrappers.proto
func EnableOptionalLabel() MessageOption {
	return func(msg *message) {
		msg.EnableOptionalLabel = true
	}
}

TBXark avatar Nov 10 '24 15:11 TBXark