-
Notifications
You must be signed in to change notification settings - Fork 809
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
customtype: no encoder for custom.Uint128 #166
Comments
protoc-gen-combo is only really useful for tests. It generates a bunch of folders for each combination of marshalers and unmarshalers, true and false. It sounds like its supposed to work.
So I think I must be missing something. Are you using the github.com/gogo/protobuf/proto library to Marshal instead of the github.com/golang/protobuf/proto library? Marshalers and Unmarshalers are only generated if they are specifically turned on.
Or you could use the protco-gen-gogofast binary.
But again everything should work even though you haven't turned on marshalers. It should just be slower. Are you maybe trying to use it on appengine? |
I'm not on appengine, not using any options, and not importing anything to Marshal since the custom.Uint128 is imported from gogo protobuf and should handle marshaling I believe. According to one line in the website, just the If I get some time, I'll put an example repo up to reproduce. |
You should be importing gogo.proto
But protoc should give a compile error if you don't. This is very weird. |
I ended up using the regular protobuf generator and converting between structs instead of this. I didn't ever put together a repro example so I'm closing. |
That is not really helping me to solve the issue :( but fair enough. |
I came across this old issue when hitting something similar with a I ended up extracting the runtime.JSONPb code, changing the mux := runtime.NewServeMux(runtime.WithMarshalerOption(runtime.MIMEWildcard, &gogomarshal.JSONPb{})) Here's my |
@abursavich note that this kind of solution has been discussed before, going back to #178. CockroachDB provided a similar solution to yours. I've written more about this an other gogo compatibility issues with the gRPC-Gateway in a post on my blog: https://jbrandhorst.com/post/gogoproto/. |
Thank you very much both of you :) @abursavich How do you use the |
@tamird What do you think about https://github.com/abursavich/gogomarshal |
@awalterschulze looks the same with a few minor differences:
Other than that, the two are identical AFAICT. |
Maybe we can standardize this marshaler and unmarshaler into a github.com/gogo repo, because this something many people use these days.
|
@awalterschulze seems fine to me. I don't think there's any reason to include a proto marshaler (i.e. https://github.com/abursavich/gogomarshal/blob/master/protopb.go) since upstream's is just fine (and was added in (grpc-ecosystem/grpc-gateway#459). We would switch to that as well, but it has the wrong content type for us. The important part is to use |
I'm new to both gogoproto and grpc-gateway. I'm happy to contribute code and it would be nice to have it in github.com/gogo, but I'm not certain that I should be the owner as I'm still ramping up at the moment. If you want to adopt my package, I agree that the naming should be changed but I don't have any good suggestions yet. I would caution that grpc-gateway's ProtoMarshaler uses |
How about the name Then we can put both marshalers in there. And if we need something else to help with grpc-gateway compatibility we can put in there are well? Regarding maintenance. Well I will also be there to help, but I would prefer if a user, even a new user :) is a maintainer, over me, an unfortunate non user :( |
Sounds good to me :) |
Are you also volunteering? :) |
I'll volunteer. |
Cool I made you admin of github.com/gogo/gateway |
@abursavich No rush. I just want to make sure. Did you receive the invite to the repo? |
Yes, I did. I have a new version of the code ready, but I'm waiting to find out about a licensing issue before pushing it. |
Cool. You are welcome to add any bsd, apache, MIT type license with any
copyright. This is just a url.
…On Wed, 28 Feb 2018, 13:19 Andy Bursavich, ***@***.***> wrote:
Yes, I did. I have a new version of the code ready, but I'm waiting to
find out about a licensing issue before pushing it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#166 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABvsLZ6JLVEgpjzsMGgaQ3oQEd_BRivMks5tZURpgaJpZM4IAT2d>
.
|
@abursavich no rush, just checking in. Have you had any luck yet? |
I've been trying out
customtype
and can't get it to work with the custom.Uint128 or any of my own types either.Take a working proto3 message type and add a
customtype
.Generation with
protoc --gogo_out=plugins=grpc:. -I=my/paths *.proto
Now whenever this message is sent across the wire, I get log output
Same issue with or without nullable.
I haven't used this library before so maybe I'm doing something basic wrong, but the cause is opaque to me. I'm testing the Uint128 here (instead of my own type) to ensure I haven't done the JSON
Marshal
andUnmarshal
incorrectly. The generated.pb.go
file contains no generated Marhsal or Unmarshal methods. How is this supposed to work? What's the support status with proto3 and customtype?I see the tests use
protoc-gen-combo
(missing docs?) but haven't been able to get that to work either. Why is it invoked that way?The text was updated successfully, but these errors were encountered: