sigstore / protobuf-specs

Protocol Buffer specifications
Apache License 2.0
22 stars 28 forks source link

How to represent `REQUIRED` on `oneof` fields. #336

Open kommendorkapten opened 1 month ago

kommendorkapten commented 1 month ago

The best option for marking a oneof field as required; i.e that exactly one of the fields must be set seems be in flux. Currently we are marking all fields in the oneof as required, which appeared to be the preferred way, link. Marking all fields as required seems to cause problems for Go reflection based field validation: https://github.com/sigstore/sigstore-go/issues/63#issuecomment-2132279557

According to this issue, there is an alternative approach. Let's explore that and see if it solves the issues we are facing, and also the annotations per that issue is more visually appealing. There is also a PR to disallow field_behavior on oneof so updating makes sense.