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

Support for proto3 optional #72

Closed
sradevski opened this issue Apr 15, 2021 · 7 comments
Closed

Support for proto3 optional #72

sradevski opened this issue Apr 15, 2021 · 7 comments

Comments

@sradevski
Copy link

Hey there, great job on making this, it is much needed.

I tried using the package, but it seems optional is not supported. When running the package, I get This file contains proto3 optional fields, but --experimental_allow_proto3_optional was not set., so maybe it's as simple as passing the experimental flag to proto-gen?

Cheers

@isteshkov
Copy link

Extremely need this feature!

@malins
Copy link

malins commented Dec 30, 2021

Just patch generator.go to also support optional keyword in proto files.

diff --git a/protoc-gen-gripmock/generator.go b/protoc-gen-gripmock/generator.go
index cdd2258..5cb63b6 100644
--- a/protoc-gen-gripmock/generator.go
+++ b/protoc-gen-gripmock/generator.go
@@ -34,6 +34,7 @@ func main() {
        // Initialise our plugin with default options
        opts := protogen.Options{}
        plugin, err := opts.New(&request)
+       plugin.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)
        if err != nil {
                log.Fatalf("error initializing plugin: %v", err)
        }

@mgerasimchuk
Copy link

Also faced:(

@sejin-P
Copy link

sejin-P commented May 15, 2022

It's because of protoc in gripmock image is 3.12.2 which cannot support optional field. I tried to fix it, but all of my effort was unnecessary.

@ringerc
Copy link

ringerc commented Apr 18, 2023

Looks like PR #119 is open for this, but unmerged/unreviewed with no comments.

@houcros
Copy link

houcros commented Aug 1, 2024

I see that #119 was merged and (as far as I can tell) released in version 1.13. Does that mean that this issue is resolved and should be closed?

@jekiapp
Copy link
Contributor

jekiapp commented Aug 2, 2024

sorry, forgot to close. Released in 1.13

@jekiapp jekiapp closed this as completed Aug 2, 2024
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

8 participants