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

protobuf: Issue with omitempty in generated protobuffers #10

Open
karlek opened this issue Sep 29, 2019 · 5 comments
Open

protobuf: Issue with omitempty in generated protobuffers #10

karlek opened this issue Sep 29, 2019 · 5 comments

Comments

@karlek
Copy link
Collaborator

karlek commented Sep 29, 2019

When strings finds a string defined at location 0, the resulting object reaching the frontend has the location field omitted since the location is 0 and thus empty. The golang code is generated with the json tag to omitempty values which causes this bug.

There are no clean solutions, but I've found these:

https://medium.com/@nevio/golang-dealing-with-protocol-buffer-omitempty-and-boolean-json-responses-ae1ba5f4e9c3

https://stackoverflow.com/questions/34716238/golang-protobuf-remove-omitempty-tag-from-generated-json-tags

@mewmew
Copy link
Contributor

mewmew commented Sep 29, 2019

Before trying a work-around, should we check how far the v2 rewrite of Protobuf has gotten? That's where we want to head going forward anyways, and with some luck this may be handled differently in v2.

@karlek
Copy link
Collaborator Author

karlek commented Sep 29, 2019

Sounds reasonable, avoid solving problems which will be solved anyway

@karlek
Copy link
Collaborator Author

karlek commented Oct 7, 2019

Do you have the link to the rewrite?

mewmew added a commit that referenced this issue Oct 8, 2019
The CI system has not yet been update to download
the needed tools for protobuf v2 generation, these
are:

   go get -u google.golang.org/protobuf/cmd/protoc-gen-go
   go get -u google.golang.org/protobuf/cmd/protoc-gen-go-grpc

Note: protoc-gen-go-grpc will move to google.golang.org/grpc
in the future (see golang/protobuf#903).

Tentative fix of #10.
This was referenced Oct 8, 2019
mewmew added a commit that referenced this issue Oct 8, 2019
The CI system has not yet been update to download
the needed tools for protobuf v2 generation, these
are:

   go get -u google.golang.org/protobuf/cmd/protoc-gen-go
   go get -u google.golang.org/protobuf/cmd/protoc-gen-go-grpc

Note: protoc-gen-go-grpc will move to google.golang.org/grpc
in the future (see golang/protobuf#903).

Tentative fix of #10.
mewmew added a commit that referenced this issue Oct 8, 2019
The CI system has not yet been update to download
the needed tools for protobuf v2 generation, these
are:

   go get -u google.golang.org/protobuf/cmd/protoc-gen-go
   go get -u google.golang.org/protobuf/cmd/protoc-gen-go-grpc

Note: protoc-gen-go-grpc will move to google.golang.org/grpc
in the future (see golang/protobuf#903).

Tentative fix of #10.
mewmew added a commit that referenced this issue Oct 8, 2019
The CI system has not yet been update to download
the needed tools for protobuf v2 generation, these
are:

   go get -u google.golang.org/protobuf/cmd/protoc-gen-go
   go get -u google.golang.org/protobuf/cmd/protoc-gen-go-grpc

Note: protoc-gen-go-grpc will move to google.golang.org/grpc
in the future (see golang/protobuf#903).

Tentative fix of #10.
@mewmew
Copy link
Contributor

mewmew commented Oct 8, 2019

A draft PR is prepared which uses v2 protobufs (see #46). However, it is not yet ready for prime time.

@mewmew mewmew changed the title Issue with omitempty in generated protobuffers protobuf: Issue with omitempty in generated protobuffers Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants