Closed sarahegler closed 2 years ago
Thanks for the PR!
Can you remove the .idea
directory from the PR? I'll test this out over this weekend.
Thanks for looking @ofpiyush - did you have a chance to test this out?
@sarahegler sorry no. My dev machine conked on Saturday, I set up a new one but forgot about it by the time I'd set new one up. 🙈
I'll check today.
@sarahegler Thanks a ton for making this change! 🎉
@avinassh I've tested it on local, we can merge it.
I'll add an optional field to our example as well as a separate PR.
Thank you @sarahegler for the PR and thank you @ofpiyush for testing it. I have merged it now 🥳
Since protobuf 3.14, the
optional
keyword can be used to distinguish between an unset and default primitive value. However, this code generator does not currently support the optional keyword; code generation of files containing theoptional
keyword result in the following error:example.proto: is a proto3 file that contains optional fields, but code generator protoc-gen-twirpy hasn't been updated to support optional fields in proto3. Please ask the owner of this code generator to support proto3 optional.
This update is to support code generation for protobuf schemas containing the optional keyword. It mirrors this change in the corresponding go code generator here: https://github.com/twitchtv/twirp/pull/332
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.