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