I've looked everywhere for this. The C# grpc people don't know how to do it, and point to the grpc/grpc people for the tooling but you're not allowed to ask questions there. I guess I could phrase this as a feature but that feels like cheating. (please add documentation too show how...)
How does one pass the parameter for this to C# grpc in the <proto> definition so that we can use the optional keyword?
Thanks!
As for January 2021, the only - yet hacky - way around this is to make your proto filename (or a directory name) contain the string test_proto3_optional
, as pointed out by protobuf documentation:
If you try to run protoc on a file with proto3 optional fields, you will get an error because the feature is still experimental. [...] There are two options for getting around this error:
- Pass
--experimental_allow_proto3_optional
to protoc.- Make your filename (or a directory name) contain the string
test_proto3_optional
. This indicates that the proto file is specifically for testing proto3 optional support, so the check is suppressed.
For more information see #977 (grpc-dotnet), #19164 (AspNetCore.Docs) and #23686 (grpc) issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With