-
Notifications
You must be signed in to change notification settings - Fork 43
Description
From README,
For proto3, the only nullable fields are other messages and oneof fields.
Note: We can update the README to includeoptional.
Currently there is no way to mark a message type or oneof type as required in proto3. But this is possible via plugins / options for example: protoc-gen-validate.
It could be super cool if we can generate not nullable message fields if the option exists (And possibly we can make it customizable):
Location home = 4 [(validate.rules).message.required = true];and the generated code would have a not-nullable home type as so
val home: pbandk.LocationI think there can be stuff that we need to consider, because this will definitely break the default constructor implementation for all protos and backwards compatibility. So we might need to add additional checks and throw exceptions like validators do to overcome unexpected errors.