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

Let service choose it's own marshaller #725

Closed
3 tasks
jinleileiking opened this issue Aug 16, 2018 · 4 comments
Closed
3 tasks

Let service choose it's own marshaller #725

jinleileiking opened this issue Aug 16, 2018 · 4 comments

Comments

@jinleileiking
Copy link

Please follow the general troubleshooting steps first:

  • Update your protoc to the latest version
  • Update your copy of grpc-gateway to the latest version from github. with
    git fetch https://github.com/grpc-ecosystem/grpc-gateway master && git reset --hard FETCH_HEAD
  • Delete the protoc-gen-grpc-gateway and protoc-gen-swagger binary from your PATH,
    and install locally built binaries.

Bug reports:

Fill in the following sections with explanations of what's gone wrong.

Steps you follow to reproduce the error:

Your steps here.

What did you expect to happen instead:

Your answer here.

What's your theory on why it isn't working:

Your theory here.

@johanbrandhorst
Copy link
Collaborator

It's possible to choose your own marshaller already with the runtime.WithMarshalerOption option: https://godoc.org/github.com/grpc-ecosystem/grpc-gateway/runtime#WithMarshalerOption.

@jinleileiking
Copy link
Author

@johanbrandhorst I mean.

each api have its own marshaller:

/api/json ---> use jsonpb marshaller
/api/form ---> user formpb marshaller

@johanbrandhorst
Copy link
Collaborator

Do you want the ability to control the marshaller per-method? You could do this kind of thing with two different gRPC-Gateway servers on the same http.Server if you split traffic in a separate handler. Would that work for you?

@jinleileiking
Copy link
Author

Do you want the ability to control the marshaller per-method?

Yes

@johanbrandhorst Can you give me an example? Thanks.

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

2 participants