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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use grpc gateway to create rest API whose body is a list #1617

Closed
ganeshdipdumbare opened this issue Aug 26, 2020 · 1 comment
Closed

Use grpc gateway to create rest API whose body is a list #1617

ganeshdipdumbare opened this issue Aug 26, 2020 · 1 comment

Comments

@ganeshdipdumbare
Copy link

馃摎 Documentation

I am not able to find documentation as well as any example in case I want to accept list in the body of rest api as follows -
[ { "email": "Hello" }, { "email": "Hello" } ]

I am not sure if it is possible to create proto message to have such a rest api. Please let me know if it is not possible as I am working with api call where 3rd party caller is sending array directly as above.

@johanbrandhorst
Copy link
Collaborator

Lists at the top level will probably require you to use google.protobuf.ListValue as request type. See https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto for these types. They have special case handling in the gateway marshaler. I speak briefly about the special case handling of the well known types in my GopherCon UK 2019 talk: https://www.youtube.com/watch?v=Pq1paKC-fXk.

If you need more assistance, please reach out on the #grpc-gateway support channel on Gophers slack.

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