-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
json 1.1 api support for grpc-ecosystem to use queryparams with filter #938
Comments
This works : https://myserver.com?filter[name]=test |
I am trying to write get api supporting json 1.1 standards. I am able to write GET api as below : filter[name]=test but not this : filter[name][startsWith]=te as PopulateQueryParameters function does not support this. I would really appreciate any help supporting this. Source : https://jsonapi.org/format/1.1/#query-parameters-families |
The gRPC gateway does not support this standard for query parameters, as you can tell. We support normal dot-separated query parameters at this time which should support your data format already. If you'd like to, I'd be happy to help you in adding support for this alternative query parameter format. I do not personally have the time to do so though. Let me know how you wish to proceed. |
Hi @johanbrandhorst, Thank you for your reply. Could you please give me example for normal dot-separated query parameters to support my data format? I will try that. |
What does your proto message type look like? AFAIK you can't do nested maps with proto, so I don't understand what you're doing. |
A good source of inspiration for your query parameters are the tests: https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/query_test.go. You can see the use of maps and nested messages. |
Hi @johanbrandhorst, My current proto definition is : map<string, string> filter I am looking for how to support JSON 1.1 API standards and change my proto where filter[x][y]=z is also allowed. |
What does |
by filter[x][y]=z I mean say filter[name][startsWith]=ab |
Ah I see. This isn't really possible to auto translate with a gRPC server backend. You'd have to handle that manually. I don't think this is really feasible from the gateway so I'm going to close this. If you have an idea for how to add support for this please reply and I can reopen it. Something like filter.field=age&filter.operator=GTE&filter.comparator=10 might work but you have to define the whole structure in your proto message. |
Support this alternative query parameter method.
The text was updated successfully, but these errors were encountered: