>From a protobuf perspective, either approach should work, so I think it is
mostly a matter of preference. I think you are right that FieldMasks
predate proto3 optional fields and were originally designed to accommodate
the lack of optional fields in proto3. Now that proto3 has optional fields,
they are a valid alternative to FieldMask.

On Wed, Nov 2, 2022 at 11:26 AM Jeff Sawatzky <jsawat...@freshbooks.com>
wrote:

> Now that protocol buffers 3 has support for optional fields
> <https://stackoverflow.com/a/62566052/2233608> which lets you test
> whether the field was set or not, are FieldMasks still useful?
>
> For instance, when implementing an Update method in gRPC which allows the
> client to update only the fields that they pass, should the method take a
> message with `optional` fields or a FieldMask? Is it a matter of personal
> preference? Or is there a benefit to one of them?
>
> We also want to expose the gRPC API as a JSON/HTTP API using either
> grpc-gateway or envoy with the grpc_json_transcoder filter. Do these have a
> preference with either pattern?
>
> I see that Googles AIPs <https://google.aip.dev/134> recommend FieldMasks
> for Update methods, but this could have been done before `optional` was
> available?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/9f8b2b48-66fe-4f97-b822-84402309a5edn%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/9f8b2b48-66fe-4f97-b822-84402309a5edn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CADqAXr4MNGCWnx__GO27Zf-1MeAB1hkAV5nyqWnZ4ugHHCEGFg%40mail.gmail.com.

Reply via email to