Skip to content

Conversation

TBXark
Copy link

@TBXark TBXark commented Nov 10, 2024

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 TBXark changed the title feat: Add proto3 optional label support entproto: Add proto3 optional label support Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant