Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --experimental_allow_proto3_optional support #14

Closed
LiuDongxu-Vungle opened this issue Nov 17, 2020 · 9 comments
Closed

Add --experimental_allow_proto3_optional support #14

LiuDongxu-Vungle opened this issue Nov 17, 2020 · 9 comments

Comments

@LiuDongxu-Vungle
Copy link

protoc v3.12.0 is going to add experimental support for the optional annotation to proto3 (see RC: https://github.com/protocolbuffers/protobuf/releases/tag/v3.12.0-rc1). We may need to update our generator(s) (protoc-gen-grpc-gateway, protoc-gen-swagger). Doc for adding this ability is here: https://github.com/protocolbuffers/protobuf/blob/v3.12.0-rc1/docs/implementing_proto3_presence.md.

@srikrsna
Copy link
Owner

lyft/protoc-gen-star#75

@xmlking
Copy link

xmlking commented Mar 2, 2021

I am stuck with missing proto3 optional support for gotag and protoc-gen-validate plugins :)
I think I should stop using cutting edge
bufbuild/protoc-gen-validate#431

@k1ng440
Copy link

k1ng440 commented Jul 4, 2021

@srikrsna why this is closed? plugin still can't set tags to optional fields

https://puu.sh/HTKb2/80dd1311fb.png

@vtolstov
Copy link

vtolstov commented Jul 4, 2021

Can you try to use protoc-gen-go-micro it supports setting tags

@srikrsna
Copy link
Owner

srikrsna commented Jul 4, 2021

@k1ng440 Thank you for flagging it is now fixed in the latest release.

@colecrouter
Copy link

On the latest version 0.6.2 I'm still getting this error when using the optional keyword.

@srikrsna
Copy link
Owner

@Mexican-Man The example in the project uses optional can you share more info on when it's not working. A small reproducible repo perhaps?

@xmlking
Copy link

xmlking commented Dec 16, 2021

I actually tied with latest version. It works now

  optional string email = 10 [(tagger.tags) = "avro:\"email\" graphql:\"withNewTags,optional\"" ];

https://github.com/xmlking/grpc-starter-kit/blob/develop/proto/mkit/mkit/service/account/entities/v1/entities.proto#L25

Using with Buf tooling

@colecrouter
Copy link

colecrouter commented Dec 16, 2021

@Mexican-Man The example in the project uses optional can you share more info on when it's not working. A small reproducible repo perhaps?

You're right, it works fine. I tried the older releases, but none of them do what I'm experiencing... I'm going to look into my deps for anything outdated/weird (old version of protoc?).

In the mean time: whoops! I'll close my pr, and I'll post back if I find anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants