You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Required in protobuf semantics generally doesn't quite behave that way; it is normal and legal to create an in-memory instance without the required fields set, the notion of required is really only only 'this must be set across the wire'.
Also worth calling out the 'required' is considered a regretted feature of Protobuf and is strongly discouraged for new usages (https://protobuf.dev/best-practices/dos-donts/#add-required), because it is extremely difficult to safely remove the field if you realize you don't need it anymore, and so will unduly constrains you from evolving your schema going forward (and the ability to have predictable behavior when safely evolving your schema over time is the main feature of protobuf).
When I use proto2's required and optional, the code generated by
protoc --dart_out=grpc:lib/src/generated -Iprotos .\protos\*
is as followsAll fields are optional, it does not follow the
required
as expectedThe text was updated successfully, but these errors were encountered: