ent / ent/ent

protoc-gen-ent: support proto3 optional fields (explicit field presence)

Open
#2,300 3 comments 0 reactions 0 assignees View on GitHub
Proposal
Dominant language
Go
Stars
17.2k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

- [x] I have searched the [issues](https://github.com/ent/ent/issues) of this repository and believe that this is not a duplicate.

## Summary 💡

About a year ago with release 3.15, the protoc maintainers enabled support for the old `optional` field modifier in proto3 by default, which is used to indicate field presence when the zero-value cannot be used. protoc-gen-ent does not yet support this.

## Motivation 🔦

Instead of writing `google.protobuf.StringValue myfield = 1;` one can again simply write `optional string myfield = 1;` when an empty string has special meaning. In Go this results in a string pointer field and a slightly changed getter method.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.