-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
hide the object name in the response #317
Comments
@Mr-Giraffe thanks for your comment. Between the fact that project uses proto3 we intend to adhere to that standard. You can't declare a direct 'repeated Message' as the response type on a grpc rpc. Here is some api design documentation that implies having this child field for a collection endpoint: https://cloud.google.com/apis/design/standard_methods#List This sort of divergence from grpc and proto3 would be inappropriate for this project. |
@tmc thanks for your reply. For example, the github restful V3 api. In their design, the list is just return an array on the top level. Current style makes sense when the response contains other thing rather than a pure list. I notice some google restful api belongs to this kind of style: https://developers.google.com/gmail/api/v1/reference/users/drafts/list Anyway, if you guys regard this is not the scope of this project, we could find some work around. |
Thanks for the comment. I would like if this project could accommodate that but I don't see how to do so in a way that doesn't cause a mismatch of sorts. I do think it's common that you would want to supply some metadata especially in the form of paging/cursors. Not returning objects top level ends up appropriate in many situations anyways. Thanks again for your comment! Sorry that this doesn't quite match what you wanted here. |
@Mr-Giraffe |
For anyone watching this issue, the solution is to use the |
In our code, we defined a message as follows:
If our rpc use QueueList as the response, we will get this json:
This is not a standard RESTful format. Is it possible to get the following json?
i.e., we don't want to add a layer which expose the object name defined in proto. Just the value of the object to json.
The text was updated successfully, but these errors were encountered: