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

Default omitemptycauses unintended behavior #238

Closed
philipithomas opened this issue Oct 12, 2016 · 1 comment
Closed

Default omitemptycauses unintended behavior #238

philipithomas opened this issue Oct 12, 2016 · 1 comment

Comments

@philipithomas
Copy link

Unintended behavior:

  1. All false booleans are always omitted
  2. Enveloping of empty response data causes the envelope to entirely disappear
  3. Integer fields of value 0 are omitted (and it's unreasonable to tell api consumers that "if it's gone assume 0 value)

Source: https://github.com/golang/protobuf/blob/master/protoc-gen-go/generator/generator.go#L1788

@philipithomas
Copy link
Author

philipithomas commented Oct 12, 2016

I did more research on this issue, the Proto3 spec, and closed issues. I see now that only jsonpb package is supported, and modifying the EmitDefaults option init shows the defaults.

In addition, for those using the grpc-gateway project, I've opened an issue for tracking of their DefaultEmpty behavior there: grpc-ecosystem/grpc-gateway#233

I'm closing this issue based on my findings.

@golang golang locked as resolved and limited conversation to collaborators Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant