-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Support optional annotation in proto3 files in generators #1278
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
i've upgraded to protoc v3.13.0 |
What version of the generator are you using? I think we might support this on v2 after #1668. Could you try https://github.com/grpc-ecosystem/grpc-gateway/releases/tag/v2.0.0-beta.5? CC @adambabik |
|
I mean, what version of |
well i installed it via
any other way to know the version ? btw i did had the experiemetal flag on
|
@johanbrandhorst |
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Hello! Any update on this? I'm trying to use the proto-gen-grpc-gateway with optional protos and I get:
Pretty sure I'm using grpc-gateway/v2, in my go.mod:
|
We can't add this support yet, but we're also not sure exactly what it should mean for the generator. See #1834 (comment) and #1834 (comment). What would you expect the effect to be on the generated files? |
Hello @johanbrandhorst, I am using Maybe the functionality shouldn't be changed, but can the generator be changed to at least compile the files properly? Maybe ignore the optional entirely? Also, maybe #1871 is related as well, since the behavior of |
Hello! Bumping this to see if there has been any progress! Adding support for optionals isn't really required for this I think, although it would be great if optional protos didn't break compilation! Thank you! |
It definitely shouldn't be breaking compilation, what errors are you seeing? The v2 generator is now built on top of protogen which should support this. |
Hello ! I installed protoc-gen-go & protoc-gen-grpc-gateway as follows:
When I generate, I have the following error: Anyway, I'm not sure I provide any new information... |
I think we need to explicitly set that optional in proto3 is supported like this https://github.com/protocolbuffers/protobuf-go/blob/ac374a2335472e7ef5b5c28e72c3060121b8d1ed/cmd/protoc-gen-go/main.go#L49 in grpc-gateway/protoc-gen-grpc-gateway/main.go Lines 56 to 98 in 80a7a7b
|
It was a bit more complicated but #1951 should fix it. I added an example with an optional field. It's actually two step process where |
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
Let `protoc` know that these generators support optional keywords. This is by no means an implementation in `grpc-gateway` of the optional aware generated code, it's just shielding of being considered as blockers in code generation workflows. Closes grpc-ecosystem#1278
protoc
v3.12.0 is going to add experimental support for theoptional
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.We're probably only going to add this to v2. It might be an opportunity to explore rewriting the generators with https://pkg.go.dev/google.golang.org/protobuf/compiler/protogen?tab=doc.
The text was updated successfully, but these errors were encountered: